EMIC2 and FOR NEXT loop question
gpierson
Posts: 23
Hello to all...newbie here. I'm playing around with my kids Boe Bot (since he's not using it!) and I bought a Sensirion SHT11 and the EMIC2.
At some point I'd like to program code that allows the EMIC2 to speak the temp at an interval (e.g. every 10 min).
I've started out playing with the EMIC2 to just say a simple value. I've tried to program it to say the value of the counter in this 0 to 10 loop. But here's the ineresting thing...it skips 1 and 6 every time! Does anyone have any ideas why it might be doing this?
Thanks in advance for your thoughts ideas!
..............
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[ Program Description ]
'
' Testing the EMIC2 with a simple FOR NEXT loop
'
'
[ I/O Definitions ]
EMIC_TX PIN 0 ' Serial output (connects to Emic 2 SIN)
EMIC_RX PIN 1 ' Serial input (connects to Emic 2 SOUT)
'
[ Constants ]
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T9600 CON 84
#CASE BS2SX, BS2P
T9600 CON 240
#ENDSELECT
EmicBaud CON T9600
counter VAR Byte
'
[ Program Code ]
FOR counter = 0 TO 7
DEBUG DEC counter
SEROUT EMIC_TX, EmicBaud, ["S", DEC counter, CR]
PAUSE 1000
NEXT
END
At some point I'd like to program code that allows the EMIC2 to speak the temp at an interval (e.g. every 10 min).
I've started out playing with the EMIC2 to just say a simple value. I've tried to program it to say the value of the counter in this 0 to 10 loop. But here's the ineresting thing...it skips 1 and 6 every time! Does anyone have any ideas why it might be doing this?
Thanks in advance for your thoughts ideas!
..............
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[ Program Description ]
'
' Testing the EMIC2 with a simple FOR NEXT loop
'
'
[ I/O Definitions ]
EMIC_TX PIN 0 ' Serial output (connects to Emic 2 SIN)
EMIC_RX PIN 1 ' Serial input (connects to Emic 2 SOUT)
'
[ Constants ]
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T9600 CON 84
#CASE BS2SX, BS2P
T9600 CON 240
#ENDSELECT
EmicBaud CON T9600
counter VAR Byte
'
[ Program Code ]
FOR counter = 0 TO 7
DEBUG DEC counter
SEROUT EMIC_TX, EmicBaud, ["S", DEC counter, CR]
PAUSE 1000
NEXT
END
Comments
SERIN EMIC_RX, EmicBaud, [WAIT(":")] ' Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command