mihaita21 0 Posted June 25, 2017 Share Posted June 25, 2017 Hello guys i'm working on an application where i need to save 2 float numbers in flash memory (i need them when the msp lose power) ,i have the hardware part done but i can't figure out the coding i'm very new to programing. I need to do something like this. int sensorPin = 23; int sensorValue = 0; float volt; // loop part sensorValue = analogRead(sensorPin); unsigned long currentMillis = millis(); timp=currentMillis/1000; if(currentMillis - previousMillis > interval) { previousMillis = currentMillis; volt=sensorValue; volt=(volt*3.3)/4096; volt=volt*8.51; putere1=volt*amp1; total_putere1=putere1+total_putere1; } media_puteri1=total_putere1/timp; energie1=media_puteri1*timp/3600; I need to save "energie1" to flash and whe my msp lose power the value stays on and then when i power it back my "energie1" value goes something like this energie1=(media_puteri1*timp/3600)+flash_value; PS: i read the ENERGIA flash write/read exemple but i don't understand how to save float values; Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.