BS2 to BS2 one wire communication...
SgtBFGunner
Posts: 33
Hello and Happy Holidays everyone!
For an experiment I have connected two BOE BS2 boards together using Dr. Humanoido's code for his BSS supercomputer.
I split the Boebot duties in half between the lower board (master) and the upper board (slave). The one wire communication is working properly as per the BSS model.
Now, when I add the IR detectors and IR LEDs to the master and then put the red LED indicators on the slave, I am having a problem getting the slave to respond past the point of responding to the master that it is there. Master sends a request to slave who is waiting to receive a "c2" (computer 2). When master sends a request to slave to blink one of the red LED's I think slave is waiting to respond to "c2" again. It is using the WAIT command. I see in the WAIT syntax that you can use a six letter word or numbers separated by commas. I tried "IRLeft"... a command on slave that says to WAIT for "IRLeft", but I don't think its getting to that line.
What I am trying to accomplish is to run a BoeBot with IR detection, but run the red LED indicators and servos from the slave BOE. Want to see how that works, how fast the communication is, etc. to prove that other accessories will work with communication between the two.
In researching the problem, I found the SELECT ... CASE command but I am trying to get WAIT to work "because it's there".
I also understand the two wire communication, but still working on this Pin 0 communication thing.
What am I missing (other than being a newb)??? THANK YOU!
(slave)
'
Main Program
DO
SERIN 0,Baud,[WAIT ("c2")] ' listen for wakeup call from master
DEBUG "c2"
GOSUB LED ' Auto Diag - blink LED
PAUSE 1000 ' wait a second
GOSUB display ' initialize display (home, clear)
SEROUT 0,Baud,["Computer 2 here!"] ' announce presence to Master
DEBUG "Computer 2 here!"
GOSUB LED ' Auto Diag - data LED/Peizo
PAUSE 1000 ' wait a second
GOSUB display ' init display
SEROUT 0,Baud,["c2"] ' finished talking, sleep
DEBUG "c2"
PAUSE 1000 ' wait a second
FOR counter = 1 TO 122
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
LOOP
SERIN 0,Baud,[WAIT ("irLeft")] ' listen for wakeup call from master
DEBUG "irLeft"
GOSUB LED ' Auto Diag - blink LED
PAUSE 1000 ' wait a second
GOSUB display ' initialize display (home, clear)
SEROUT 0,Baud,["irLeft!"] ' announce presence to Master
DEBUG "irLeft!"
GOSUB LED ' Auto Diag - data LED/Peizo
PAUSE 1000 ' wait a second
GOSUB display ' init display
SEROUT 0,Baud,["irDetectLeft Clear"] ' finished talking, sleep
DEBUG "irDetectLeft Clear"
PAUSE 1000 ' wait a second
FOR counter = 1 TO 122
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
(master)
'
Talk to Computer 2
SEROUT 0,Baud,["c2"] ' talk to the net, wake up worker computer #2
DEBUG "c2"
SERIN 0,Baud,[WAIT ("c2")] ' wait computer 2 to finish talking
DEBUG "c2"
PAUSE 2000 ' pause for serial
LOOP ' again
'
irLeft Talk to Computer 2
GOSUB Display ' LCD initialize (clear & home)
GOSUB LED ' LCD blink LED
SEROUT 0,Baud,["irLeft"] ' talk to the net, wake up worker computer 3
DEBUG "irLeft"
SERIN 0,Baud,[WAIT ("irLeft")] ' wait for computer 3 to finish talking
DEBUG "irLeft"
PAUSE 2000 ' pause for serial
For an experiment I have connected two BOE BS2 boards together using Dr. Humanoido's code for his BSS supercomputer.
I split the Boebot duties in half between the lower board (master) and the upper board (slave). The one wire communication is working properly as per the BSS model.
Now, when I add the IR detectors and IR LEDs to the master and then put the red LED indicators on the slave, I am having a problem getting the slave to respond past the point of responding to the master that it is there. Master sends a request to slave who is waiting to receive a "c2" (computer 2). When master sends a request to slave to blink one of the red LED's I think slave is waiting to respond to "c2" again. It is using the WAIT command. I see in the WAIT syntax that you can use a six letter word or numbers separated by commas. I tried "IRLeft"... a command on slave that says to WAIT for "IRLeft", but I don't think its getting to that line.
What I am trying to accomplish is to run a BoeBot with IR detection, but run the red LED indicators and servos from the slave BOE. Want to see how that works, how fast the communication is, etc. to prove that other accessories will work with communication between the two.
In researching the problem, I found the SELECT ... CASE command but I am trying to get WAIT to work "because it's there".
I also understand the two wire communication, but still working on this Pin 0 communication thing.
What am I missing (other than being a newb)??? THANK YOU!
(slave)
'
Main Program
DO
SERIN 0,Baud,[WAIT ("c2")] ' listen for wakeup call from master
DEBUG "c2"
GOSUB LED ' Auto Diag - blink LED
PAUSE 1000 ' wait a second
GOSUB display ' initialize display (home, clear)
SEROUT 0,Baud,["Computer 2 here!"] ' announce presence to Master
DEBUG "Computer 2 here!"
GOSUB LED ' Auto Diag - data LED/Peizo
PAUSE 1000 ' wait a second
GOSUB display ' init display
SEROUT 0,Baud,["c2"] ' finished talking, sleep
DEBUG "c2"
PAUSE 1000 ' wait a second
FOR counter = 1 TO 122
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
LOOP
SERIN 0,Baud,[WAIT ("irLeft")] ' listen for wakeup call from master
DEBUG "irLeft"
GOSUB LED ' Auto Diag - blink LED
PAUSE 1000 ' wait a second
GOSUB display ' initialize display (home, clear)
SEROUT 0,Baud,["irLeft!"] ' announce presence to Master
DEBUG "irLeft!"
GOSUB LED ' Auto Diag - data LED/Peizo
PAUSE 1000 ' wait a second
GOSUB display ' init display
SEROUT 0,Baud,["irDetectLeft Clear"] ' finished talking, sleep
DEBUG "irDetectLeft Clear"
PAUSE 1000 ' wait a second
FOR counter = 1 TO 122
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
(master)
'
Talk to Computer 2
SEROUT 0,Baud,["c2"] ' talk to the net, wake up worker computer #2
DEBUG "c2"
SERIN 0,Baud,[WAIT ("c2")] ' wait computer 2 to finish talking
DEBUG "c2"
PAUSE 2000 ' pause for serial
LOOP ' again
'
irLeft Talk to Computer 2
GOSUB Display ' LCD initialize (clear & home)
GOSUB LED ' LCD blink LED
SEROUT 0,Baud,["irLeft"] ' talk to the net, wake up worker computer 3
DEBUG "irLeft"
SERIN 0,Baud,[WAIT ("irLeft")] ' wait for computer 3 to finish talking
DEBUG "irLeft"
PAUSE 2000 ' pause for serial
Comments
Now to get IR detection working on the master with servos and LED indicators responding on the slave.
Problem was this:
slave-
SEROUT 0,Baud,["irDetectLeft Clear"] ' finished talking, sleep
master-
SERIN 0,Baud,[WAIT ("irLeft")] ' wait for computer 3 to finish talking
I changed the slave's line to "irLeft" and the program then continued on to "irRght" and then LOOP'ed appropriately.