Repeating and not saving information on a AXE1337 OLED and PICAXE CHIP

Tobie Calvert

New Member
Hello,

I have a problem regarding my PICAXE OLED and CHIP to where when information is inputted via a switch, it counts the value and stores it but as soon as I turn the device off it no longer stores the information and restarts the code which isn't what i want it to do. Also when the code is run, the OLED then repeats all the lines of code but I want it to just display the single line of code.

For example
"Your balance is: 0" after input "Your balance is: 2 Your balance is:.."
Below I have attached the code.
Thank you very much for your help and all help is gratefully appreciated.
Many thanks,
Tobie View attachment Jordan.bas
 

Technical

Technical Support
Staff member
Code:
init: pause 10
main: serout B.1,N2400, (254,128)


main2:
serout B.1,N2400, ("Your Balance Is:")
pause 10 
serout B.1,N2400, (254,192,#w0, "  ")


main1:
if pinC.4 = 1 then pence5
if pinC.0 = 1 then pence1
if pinC.2 = 1 then pence2
goto main1


pence5:
let w0 = w0 + 5
goto main2


pence1:
let w0 = w0 + 1
goto main2


pence2:
let w0 = w0 + 2
goto main2
You need to use read/write commands to save when the chip is powered down - so a write in each pence section and a read right at the start in init.

If you only want the second line to update, move the main2 label below the first serout line instead of above.
 
Top