SV: Serin
Archiver
Posts: 46,084
In a message dated 5/30/2004 12:21:58 PM Eastern Daylight Time,
robert.bohlin@b... writes:
Are you trying to turn the LED on and off with the "pinstate" part of the
serin?
You don't need the "wait(255)" if you are entering data from the keyboard.
That is only used when a Stamp is serouting to another Stamp.
If you want to turn your LED on with a serin command, try this:
serout 16, baud, [noparse][[/noparse]"Enter command - A for On, B for Off", cr]
serin 16, baud, [noparse][[/noparse]com]
if com = "A" or com = "a" then gohigh
if com = "B" or com = "b" then golow
> SERIN 16,16780,1000,starta, [noparse][[/noparse]WAIT(255), PinState]
>
> starta:
> pinstate=pinstate
> IF pinstate=1 THEN gohigh
> IF pinstate=0 THEN golow
> PAUSE 1000
> GOTO start
> gohigh:
> pin=pinstate 'delete this line
> HIGH 8
> GOTO start
> golow:
> pin=pinstate 'delete this line
> LOW 8
>
> GOTO start
>
[noparse][[/noparse]Non-text portions of this message have been removed]
robert.bohlin@b... writes:
Are you trying to turn the LED on and off with the "pinstate" part of the
serin?
You don't need the "wait(255)" if you are entering data from the keyboard.
That is only used when a Stamp is serouting to another Stamp.
If you want to turn your LED on with a serin command, try this:
serout 16, baud, [noparse][[/noparse]"Enter command - A for On, B for Off", cr]
serin 16, baud, [noparse][[/noparse]com]
if com = "A" or com = "a" then gohigh
if com = "B" or com = "b" then golow
> SERIN 16,16780,1000,starta, [noparse][[/noparse]WAIT(255), PinState]
>
> starta:
> pinstate=pinstate
> IF pinstate=1 THEN gohigh
> IF pinstate=0 THEN golow
> PAUSE 1000
> GOTO start
> gohigh:
> pin=pinstate 'delete this line
> HIGH 8
> GOTO start
> golow:
> pin=pinstate 'delete this line
> LOW 8
>
> GOTO start
>
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
robert.bohlin@b... writes:
> I did that and it worked..but now the led starts to flash...i want it to
> be "turned on"
> Does the serin you wrote reset
> Here is a bit of the program i did
> SEROUT
> 16,16780,[noparse][[/noparse]tc.HIGHBYTE,tc.LOWBYTE,rct.HIGHBYTE,rct.LOWBYTE,ljus.HIGHBYTE,
> ljus.LOWBYTE,temp.HIGHBYTE,temp.LOWBYTE]
> SERIN 16,16780,1000,starta, [noparse][[/noparse]WAIT(255), PinState]
>
Robert, in the sample code I just sent you, serin wikll sit and wait forever
for you to enter something. If you want it to maintin the last command you
sent the change the serin to read:
serin 16, baud, 2000, starta, [noparse][[/noparse]com]
After 2 seconds the program will jump to starta. If the LED was previously
On, it will stay on, If it was previously Off, it will stay off. It will
maintain its last state until you enter a different serin command.
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
Ursprungligt meddelande
Fr