sending a variable

Community forum for discussion and support of the PINK product and development kit
Post Reply
wiresalot
Posts: 7
Joined: Mon Dec 27, 2010 4:01 pm

sending a variable

Post by wiresalot »

Hello,

Im using an rc time program on my BS2 changing it with a POT. The value changes and shows numbers, The pink recieves it, But displays odd charcters and not the number i need it to be a number. How can I make it be a number only?


Code: Select all

nbvar           VAR     Byte            ' PINK Data Variable


' -----[ Program Code ]----------------------------------------------------



DO
 HIGH 10
 PAUSE 1
 RCTIME 10, 1, nbvar
 DEBUG HOME, "time= ", DEC5 nbvar

SEROUT TX, Baud, ["!NB0W20:", nbvar, CLS]
LOOP
Thanks

wiresalot
thomastaranowski
Posts: 82
Joined: Sun May 11, 2008 2:17 pm
Location: Los Angeles, CA
Contact:

Re: sending a variable

Post by thomastaranowski »

You'll need to convert your raw number stored in nbval to ascii text for display (http://www.manpagez.com/man/7/ascii/). In C you'd use printf, itoa, or stringstream. No idea what you got going with basic, but I'm sure there's an equivalent.
wiresalot
Posts: 7
Joined: Mon Dec 27, 2010 4:01 pm

Re: sending a variable

Post by wiresalot »

Thanks for the reply.

Well basically im trying to use a thermistor for temperature reading, have a potentiometer conected now, until I get a thermistor. just trying to get the code to work.

"nbval" what is that :)
I didnt see it in Variable table.

Thanks for your reply.

wiresalot
wiresalot
Posts: 7
Joined: Mon Dec 27, 2010 4:01 pm

Re: sending a variable

Post by wiresalot »

I figuered it out I had to add DEC5.

Code: Select all

nbvar           VAR     Byte            ' PINK Data Variable


' -----[ Program Code ]----------------------------------------------------



DO
HIGH 10
PAUSE 1
RCTIME 10, 1, nbvar
DEBUG HOME, "time= ", DEC5 nbvar

SEROUT TX, Baud, ["!NB0W20:", DEC5 nbvar, CLS]
LOOP
Thank you thomastaranowski

wiresalot
Post Reply