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...