Store Variable Basic Stamp 2
Luis_P
Posts: 246
Hello, Please help! help! help!
I'm getting crazy trying to store a variable on the stamp 2, After program runs completely I need to keep a number on a variable, how do I do that?
In Visual Basic we use global or public variable but on PBasic I have not idea, please dump some code so I can understand. I'm new on this.
Gracias!!!!
' {$STAMP BS2}
' {$PBASIC 2.5}
·
I'm getting crazy trying to store a variable on the stamp 2, After program runs completely I need to keep a number on a variable, how do I do that?
In Visual Basic we use global or public variable but on PBasic I have not idea, please dump some code so I can understand. I'm new on this.
Gracias!!!!
' {$STAMP BS2}
' {$PBASIC 2.5}
·
Comments
The Pbasic help files and manual have plenty of examples and if you are already familiar with aspects of Basic programming you should be up and running very quickly, when you run into difficulty or aspects of the manual you don't understand then this forum is a great resource to turn to for further advice.
Jeff T.
·
· I tried x VAR Byte. but when the pogram finish next time I run that variable when back to Zero.
I need to store an acummulative value example:
Run the program first time:
x = 0
Run the program second time:
x = 1
So I think I need something like x = x + 1 every time I run the program the variable x = 0 it should be read only at the first time so I can use a code like this:
If x = 1 then goto firts_Subrutine·
x = 0
'code here for x = 0
end
First_Subrutine:
'seconde code here if x equal to 1
Luis
Read the Basic Stamp manual's entries on those two commands carefully. It's pretty clear how to use them, but you'll want to be familiar with what's happening.
Oh, and you should know that the PBasic program is stored in the eeprom from high addresses down, while your "DATA" and "READ/WRITE" locations start at zero up.
In other words, you can WRITE to location zero or one or two safely.
· So I have to write a code that before reaches the million times to use another location, mmmm sounds dificult, any ideas?
Luis