Blockly and Xbee sending and receiving multiple variables
graffix
Posts: 389
Ive put together some code in blockly. So far Ive done a few things. Im trying to get all of the things assembled into two codes for a receiver and transmitter for a robot. I had it working. I was able to drive around. I then added some pushbuttons to the controller side of code. Ive used the serial terminal to see the code is doing as it should. Which it is. I dont think the sending and receiving portion of code is correct though. I receive one variable and then zeros for the rest. The one that comes through now doesnt change when the joystick is pressed either. Basically I have a Prop Boe for the controller. Using Rc time to read values from the two joysticks. Which are only using the Up/Down on each. There are two push buttons and two leds tied to each. That gives me 4 different modes the controller could be in. Zero leds on is mode 1, 1 led on is mode 2, the other is mode 3, lastly both on is mode 4. Then send that to the receiving Arlo. Im trying to work in sections and add on elements. Adding the pushbutton routine messed up what I had working for just driving it around. The Arlo is using a Prop activity board WX. I have the Arlo kit built and tested. There is one standard servo at the moment with a ping attached. So Id like to drive the Arlo using the two joysticks in a tank style steering as mode 1. When in mode 2 Id like one joy stick to control the servo instead of the drive system. While sending back ping distance be displayed on a lcd. I think my section of code for sending needs adjusted so I keep receiving the right numbers though. Can someone show me using blockly how I can send this and receive it to work with?
Comments
dgately
Try something like this for receiving each value:
An XBee controller on a Propeller Project Board USB #32810 (has buttons and a joystick for control)
An XBee on a Propeller Activity Board #32912, on a wheeled Parallax Stingray Robot frame
As luck would have it, the program was written in Spin, and I was able to use JonnyMac's "HumanFriendlyControlProtocol" object. That object handles the processing of numeric and text data to/from any source (serial, XBee, etc...). Since you are using Blockly Prop, I'll just give you the jest of what might be done:
Very simplified example... You'll want to check the msg-type before the case block...
dgately