EB 500 Relay Control
Jeremy Norris
Posts: 5
I have been trying to figure out how to throw a relay with the EB 500 bluetooth appmod, and so far i have just hooked an optocoupler up to the pin that goes high whenever there is a conection (pin 5).· That works fine so far, but I would like to write a program that would allow me to tie in multiple relays.· Any Input would be appreciated.
P.S.· Im trying to develop a small automotive control system, nothing special, I have a 1987 Trans Am, and I want my own version of "KITT" From the (Knight Rider series).
P.S.· Im trying to develop a small automotive control system, nothing special, I have a 1987 Trans Am, and I want my own version of "KITT" From the (Knight Rider series).
Comments
The EB500 is serial in nature, so once you’ve established communication you can send a byte variable over to the BASIC Stamp with bits set for relays you want turned on/off connected to the I/O port. You could even write the variable directly to the appropriate OUTH/OUTL register. I would focus on serial communication first then send that control byte. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
I just thought of an easier way to do what i want to do, the only problem is, i found out i realy dont know what im doing.
the block of code i want to·modify comes right out of "Stamp Works" with a few modifications.
' =========================================================================
'
'·· File....... SW21-EX23-74HC595-1.BS2
'·· Purpose.... Expanded outputs with 74HC595
'·· Author..... (C) 2000 - 2005, Parallax, Inc.
'·· E-mail..... support@parallax.com
'·· Started....
'·· Updated.... 01 SEP 2005
'
'·· {$STAMP BS2}
'·· {$PBASIC 2.5}
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
'
' This program demonstrates a simple method of turning three BASIC Stamp
' I/O pins into eight digital outputs with a 74HC595 shift register.
'
[noparse][[/noparse] I/O Definitions ]
Clock·········· PIN···· 0······················ ' shift clock (74HC595.11)
SerData········ PIN···· 1······················ ' serial data (74HC595.14)
Latch·········· PIN···· 2······················ ' output latch (74HC595.12)
'
[noparse][[/noparse] Constants ]
DelayTime······ CON···· 100
'
[noparse][[/noparse] Variables ]
pattern········ VAR···· Byte··················· ' zig-zag pattern
'
[noparse][[/noparse] Initialization ]
Reset:
· LOW Latch···································· ' make output and low
· pattern = %00000001
'
[noparse][[/noparse] Program Code ]
Main:
· DO
····· GOSUB Out_595······························ ' put pattern on 74x595
··· PAUSE DelayTime···························· ' hold
··· pattern = pattern << 1····················· ' shift pattern left
· LOOP UNTIL (pattern = %10000000)
· DO
··· GOSUB Out_595
··· PAUSE DelayTime
··· pattern = pattern >> 1····················· ' shift pattern right
· LOOP UNTIL (pattern = %00000001)
· GOTO Main
'
[noparse][[/noparse] Subroutines ]
Out_595:
· SHIFTOUT SerData, Clock, MSBFIRST, [noparse][[/noparse]pattern]· ' send pattern to '595
· PULSOUT Latch, 5····························· ' latch outputs
· RETURN
This gives me a prety nice "KITT Scanner"· but i cant seem to figure out how to tie this in with the EB 500 detecting a connection on pin 5.· i know i have to switch around the pins to ones that the EB 500 does not use.· All i want is to connect with the EB 500 and make it execute the batch of code untill i disconnect the bluetooth.
Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
IF IN5 = 0 THEN Main
That will loop until a connection is made then start the sequence. It will keep looping until the connection is lost. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Thanks a lot Mr Savage