Skip to content

Instantly share code, notes, and snippets.

@rmit-s3545996-leanne-tran
Last active June 16, 2021 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmit-s3545996-leanne-tran/a10d1cce0344d0cd839e37a35c1291f1 to your computer and use it in GitHub Desktop.
Save rmit-s3545996-leanne-tran/a10d1cce0344d0cd839e37a35c1291f1 to your computer and use it in GitHub Desktop.
xBee transmit and recieve

Send a personalised message through one xBee and get it on the other one!

Remember to configure your Port number before deploying. This can be found in Windows by going to 'Device Manager' and seeing which ports are connected.

[{"id":"aee4e13d.075b7","type":"tab","label":"Send/Recieve xBee","disabled":true,"info":"Send a personalised message to your xBee transmitter and see that message on your xBee reciever"},{"id":"428bdecb.3eef2","type":"xbee-rx","z":"aee4e13d.075b7","name":"xBee rx","xBee":"f466bf11.58b12","x":230,"y":40,"wires":[["be678a3.11bb678"]]},{"id":"be678a3.11bb678","type":"debug","z":"aee4e13d.075b7","name":"xbee recieved","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":480,"y":40,"wires":[]},{"id":"947859d8.5e11c8","type":"xbee-tx","z":"aee4e13d.075b7","name":"","xBee":"662f3166.97e2a","x":500,"y":160,"wires":[]},{"id":"7cc39ec6.350d3","type":"function","z":"aee4e13d.075b7","name":"dataFrame","func":" var myDataFrame1 = {\n type: 0x10,\n id: 0x01,\n destination64: \"0013a200400a0127\",\n destination16: \"fffe\",\n broadcastRadius: 0x00,\n options: 0x00,\n data: flow.get(\"words\")||\"hello\"\n };\n msg.payload=myDataFrame1;\n\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":160,"wires":[["947859d8.5e11c8","37b8bc95.232c14"]]},{"id":"9df8b4c8.697da8","type":"inject","z":"aee4e13d.075b7","name":"inputLoop","topic":"","payload":"[]","payloadType":"json","repeat":"5","crontab":"","once":true,"onceDelay":0.1,"x":130,"y":160,"wires":[["7cc39ec6.350d3"]]},{"id":"79abc143.509d5","type":"ui_text_input","z":"aee4e13d.075b7","name":"dataIn","label":"DATA INPUT","tooltip":"TYPE HERE","group":"8a213d1c.f3679","order":4,"width":0,"height":0,"passthru":false,"mode":"text","delay":300,"topic":"words","x":250,"y":240,"wires":[["1dd55121.d4815f"]]},{"id":"37b8bc95.232c14","type":"debug","z":"aee4e13d.075b7","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":490,"y":100,"wires":[]},{"id":"1dd55121.d4815f","type":"function","z":"aee4e13d.075b7","name":"save input","func":"flow.set(\"words\", msg.payload)\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":240,"wires":[[]]},{"id":"f466bf11.58b12","type":"xbee-config","z":"","apiMode":"2","rawFrames":false,"convertAdc":true,"vrefAdc":"1200","serialPort":"COM5","lock":true,"baudRate":"9600","dataBits":"8","stopBits":"1","parity":"none","bufferSize":"65536","rtscts":false,"xon":false,"xoff":false,"xany":false,"vmin":"1","vtime":"0"},{"id":"662f3166.97e2a","type":"xbee-config","z":"","apiMode":"2","rawFrames":false,"convertAdc":true,"vrefAdc":"1200","serialPort":"COM6","lock":true,"baudRate":"9600","dataBits":"8","stopBits":"1","parity":"none","bufferSize":"65536","rtscts":false,"xon":false,"xoff":false,"xany":false,"vmin":"1","vtime":"0"},{"id":"8a213d1c.f3679","type":"ui_group","z":"","name":"DATA INPUT","tab":"11214bd0.b00df4","disp":true,"width":"6","collapse":false},{"id":"11214bd0.b00df4","type":"ui_tab","z":"","name":"XBEE STUFF","icon":"dashboard","disabled":false,"hidden":false}]
@martin9115
Copy link

Hi, i try your example, but i can't see the message ''Hello'', that supposed to come up and i've got this in the debug node.
Where can be my mistake?

XBee Send_Receive
XBee Send_Receive  1
XBee Send_Receive 2

@3amWednesday
Copy link

It seems you haven't entered anything into the text input yet. Its been a while, but if I remember properly, I'd set it up so that anything in the input is sent forward after the ENTER button is pressed on the keyboard. Either that or you did send correctly, but everything has been reverted to lowercase, so you are confusing your correct input with the default.

To check if you've managed to 'save' your inout into the flow: Get a input node, inject a flow property of "words", and stick a DEBUG node on the end to see what comes out.

To demo the connection itself, if the whole flow property thing is confusing you, hardcode the data variable yourself in the function window of the last image. Maybe something different in case upper and lower case is ignored, like hell0w0rld, or numb3rs, or so.

On the side, special characters outside the standard english keyboard symbols react strangely when sent. I had fun entering Chinese and Arabic and emojis into the input and seeing the gibberish that came out.

@MartinSokolov15
Copy link

I repeat every step you did.
This is my setups, please can you tell me where are my mistakes?

XBEE TEST 5

@MartinSokolov15
Copy link

Have you try it with XBee 3 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment