Parsing a Variable
s2jesse
Posts: 62
Hello,
Im trying to parse a variable but not sure how to do it.
I need to find a way to do a for loop on each character of a variable. so i can pass each char out to an lcd individually.
for instance
message "hello please parse me"
for "each letter in messge"
something like
READ message + index, char (however read works on eprom and i dont want to read it from eprom
Hope that made some sense.
Thanks Jesse
Im trying to parse a variable but not sure how to do it.
I need to find a way to do a for loop on each character of a variable. so i can pass each char out to an lcd individually.
for instance
message "hello please parse me"
for "each letter in messge"
something like
READ message + index, char (however read works on eprom and i dont want to read it from eprom
Hope that made some sense.
Thanks Jesse
Comments
·· What you're trying to do can't be done with a variable.· You could put the DATA into EEPROM and read it one character at a time from there.· In the BASIC Stamp Editor, please click on help, and PBASIC Syntax, then click on the READ command.· In the example link is code to do what you're talking about.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Thanks though.
Jesse
MyArray var byte(size) ' where size is how many characters you want in your message
Then you'd go through it with a for..next loop like this:
for n = 0 to size
MyArray(n) = 1 'instead of storing 1, you'd probably want to do something actually useful like output to the LCD
next
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com