📬❄️📦Adafruit Holiday Shipping Deadlines 2019: Please place all UPS 3 Day orders by 11am ET Friday December 13 📬❄️📦
0

Newb.. With Questions
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Newb.. With Question on what to use.

by Blue_Ice on Fri Jan 29, 2016 6:20 pm

adafruit_support_bill wrote:
Code: Select all | TOGGLE FULL SIZE
  // print a hex number
  matrix.print(0xF, HEX);
  matrix.writeDisplay();


i understand that but im trying to combine them both at the same time on the display.. I can get the hex to show alone and the temp to show alone but not both at the same time.

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by adafruit_support_bill on Fri Jan 29, 2016 6:34 pm

You should be able to print one, followed by the other. Please post the code that you are using.

adafruit_support_bill
 
Posts: 75285
Joined: Sat Feb 07, 2009 10:11 am

Re: Newb.. With Question on what to use.

by Blue_Ice on Fri Jan 29, 2016 6:48 pm

adafruit_support_bill wrote:You should be able to print one, followed by the other. Please post the code that you are using.


Code: Select all | TOGGLE FULL SIZE

   TEMP_Update( );
    matrix.print(0xF, HEX);
    matrix.print( valTemp, DEC );
    matrix.writeDisplay();
    delay(5000);



Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by adafruit_support_bill on Fri Jan 29, 2016 6:58 pm

And what do you see on the display when you run that?

adafruit_support_bill
 
Posts: 75285
Joined: Sat Feb 07, 2009 10:11 am

Re: Newb.. With Question on what to use.

by Blue_Ice on Fri Jan 29, 2016 7:39 pm

First 2 digits are blank the last 2 show the temp

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by adafruit_support_bill on Sat Jan 30, 2016 5:50 am

It looks like the library treats a print the same as a println. You will probably need to use the writeDigitNum function to write the "F" in position 0 after you print the value.

The call is: writeDigitNum(location, number);

where location is the position on the display (0) and the number is the digit to print (0x0F).

https://learn.adafruit.com/adafruit-led ... k-firmware

adafruit_support_bill
 
Posts: 75285
Joined: Sat Feb 07, 2009 10:11 am

Re: Newb.. With Question on what to use.

by Blue_Ice on Sat Jan 30, 2016 1:25 pm

I forgot about that thanks !

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by Blue_Ice on Sat Jan 30, 2016 3:30 pm

Something still amiss

Code: Select all | TOGGLE FULL SIZE
 TEMP_Update( );
    matrix.writeDigitNum(0,0x0F);
    matrix.print( valTemp, DEC );
    matrix.writeDisplay();
    delay(5000);



Using this code still get only temp display, if i comment out the matrix.print( valTemp, DEC); line I do get the "F" on the far left. that is good but as soon as have them both there no luck..

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by adafruit_support_bill on Sat Jan 30, 2016 4:17 pm

I think you need to print the "F" last. The print statement clears the leading digits.

adafruit_support_bill
 
Posts: 75285
Joined: Sat Feb 07, 2009 10:11 am

Re: Newb.. With Question on what to use.

by Blue_Ice on Sat Jan 30, 2016 5:26 pm

adafruit_support_bill wrote:I think you need to print the "F" last. The print statement clears the leading digits.



That works !!

anychance you could post a example bit to show use of this ?

call writeDigitRaw(location,bitmask) to draw a raw 8-bit mask (as stored in a uint8_t) to anylocation.


i have searched and read for about 3 hours and have no luck figuring it out

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by Blue_Ice on Tue Feb 23, 2016 11:14 pm

Just want to start off by saying thanks for the input.

I'm still learning but so far I have accomplished quite abit. I am actually building a digital type dash using the 7 Seg displays and a LCD 2x16 for odometer reading and a few other things.

My project now consits of the following things
UNO R3 (for proto then moving to a Trinket Pro 5V)
5 7 Segment Displays
1 16x2 LCD Screen
1 Ultimate GPS (for speedometer & odometer functions)
1 FRAM breakout board for storing odometer readings
1 digital temp sensor working
1 analog presure sensor up and working
1 voltage meter


i have learned alot from the forums and appreciate the advice given by all. I'm in the last phase now with the project and that is mapping out RPM ranges from a coil input I have read many threads and feel it should work great base don other outcomes. Forums are great to learn and ADAFRUIT is awesome for all things.

I am at a crossroad and not 100% sure on 1 function for the odometer to save data. I want to write a value to the FRAM and have no real idea of how to go about it. I have some things defined and they come up with values but i dont know how to store them correctly. and advice would be great..


I'll post a snippet of code in hopes its simple and im just not understanding it..

Code: Select all | TOGGLE FULL SIZE
// Read the first byte
   uint8_t test = fram.read8(0x0);
  Serial.print("Stored Number = "); Serial.print(test); Serial.println(" Miles");

  // Test write ++
  fram.writeEnable(true);
  fram.write8(0x0, test+1);
  fram.writeEnable(false);


this works fine and updates every reboot of the uno as the learn page says it should. my problem is i need to set a initial number such as 102567.25 as the starting number then have a variable that runs in another process update it.

I have a bit more code that shows some of the process of the calculation of mileage.
Code: Select all | TOGGLE FULL SIZE
// If we're moving, calculate and save distance traveled
      if( mph > 2.0f )
      {
        if( latitude != 0.0f )
        {
          float distance = DistanceBetween2Points( latitude, longitude, f_lat, f_lon, MILES_PER_METER );
         
          if( distance >= 0.04f )      // Accumulate every 25th of a mile
          {
            f_ODO += distance;
            valODO = f_ODO;      // Update display values

// this is where I would want to update the FRAM value as well
  fram.writeEnable(true);
  fram.write8(0x0, valODO);
  fram.writeEnable(false);
// but I have no clue !



i hope i made sense of all this im not a wiz at all.

basically i want to set in the FRAM address a initial value of say 102567.25 then when i get the new value from valODO i want to update the FRAM with the new value.

Sorry for the long post but I'm still learning.. Maybe I should start a new post rather than gob onto my original.. Maybe i just dont understand the uint_8t and uint_16t stuff enough. (im reading alot but confused.)


Once i'm done i'll post my working archaic code for comments....

Thanks in advance...

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Questions

by Blue_Ice on Tue Feb 23, 2016 11:25 pm

thought a shot of dash was in order.
Image

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Questions

by adafruit_support_bill on Wed Feb 24, 2016 6:52 am

Thanks for the photos. It's looking good!

Not sure if I understand the problem correctly. But it sounds like you just need 2 programs. One to set the initial value. That should be fairly simple to write. Once you have the initial value written, then just load your regular program which will take it from there.

adafruit_support_bill
 
Posts: 75285
Joined: Sat Feb 07, 2009 10:11 am

Re: Newb.. With Questions

by Blue_Ice on Wed Feb 24, 2016 9:40 am

adafruit_support_bill wrote:Thanks for the photos. It's looking good!

Not sure if I understand the problem correctly. But it sounds like you just need 2 programs. One to set the initial value. That should be fairly simple to write. Once you have the initial value written, then just load your regular program which will take it from there.



Sorry if I confused ya

basically Im stumped on how the FRAM Write works.

I need to write 102567.25 to the FRAM I know I need to use fram.write8(0x0, data?); I got the first part that tells it to write to the FRAM and then it tells it it's location to write. My problem is how do I format the rest of the statement.. (the part that says data? ) this is where I might be way to new at this to figure out.. I can't just put a number there as it does not write the number.. I tried and it returns 255 when I read it.. I i have all the other programming working to get the values I need i'm just having trouble writing them to FRAM to save them.

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Questions

by adafruit_support_bill on Wed Feb 24, 2016 9:56 am

I think I understand now. You want to know how to write a huge number to FRAM when the write function only takes a byte at a time?

You could do it pretty much the same way we read and write to EEPROM here:
https://learn.adafruit.com/sous-vide-po ... stent-data

The 'sizeof()' function returns the number of bytes in the data type. So you can just loop on that:

Code: Select all | TOGGLE FULL SIZE
// ************************************************
// Write floating point values to EEPROM
// ************************************************
void EEPROM_writeDouble(int address, double value)
{
   byte* p = (byte*)(void*)&value;
   for (int i = 0; i < sizeof(value); i++)
   {
      EEPROM.write(address++, *p++);
   }
}
 
// ************************************************
// Read floating point values from EEPROM
// ************************************************
double EEPROM_readDouble(int address)
{
   double value = 0.0;
   byte* p = (byte*)(void*)&value;
   for (int i = 0; i < sizeof(value); i++)
   {
      *p++ = EEPROM.read(address++);
   }
   return value;
}

adafruit_support_bill
 
Posts: 75285
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.