Python code to send images over xbee s2 ..?

Stuck with a problem in your code? Seek help here.

Python code to send images over xbee s2 ..?

Postby s4sarath » January 31st, 2014, 1:27 am

Hi Guys

Its my first post here in this forum. So, spare me if I ask something wrong. I want to send images over two xbee s2 , via a python code. I am able to connect two xbees. Now I want to write a python code to send and recieve images. So , I am requesting you to provide me with necessary and valuable instructions for my code.
Note : i am not asking you guys to write code for me. As, i am a rookie I am stuck. Please help.

Thanks in advance
s4sarath
 
Posts: 4
Joined: January 31st, 2014, 1:21 am

Re: Python code to send images over xbee s2 ..?

Postby annath » January 31st, 2014, 9:10 pm

Off the top of my head, you could break the image data into chunks and use the python struct library to convert the chunk data into strings. Then you can transmit those strings across the Zigbee Link like you normally would.
annath
 
Posts: 26
Joined: December 15th, 2013, 3:50 pm

Re: Python code to send images over xbee s2 ..?

Postby s4sarath » February 2nd, 2014, 8:27 am

Thanks . So you are suggesting to divide the data ( image ) into bytes and send it as strings ????
s4sarath
 
Posts: 4
Joined: January 31st, 2014, 1:21 am

Re: Python code to send images over xbee s2 ..?

Postby annath » February 2nd, 2014, 7:25 pm

Essentially yeah. Break it into ~50 byte chunks (that's a pretty decent size for ZigBee packets), and use the python struct tools to pack each chunk into a string. Write that string just like you normally would into the Xbee and on the other side, unpack it. Append it onto the end of an array of bytes, and when everything finishes transmitting, you can write the array back to disk and you've got your image file.
annath
 
Posts: 26
Joined: December 15th, 2013, 3:50 pm

Re: Python code to send images over xbee s2 ..?

Postby s4sarath » February 3rd, 2014, 10:17 pm

Thanks for your reply . I will try to do it . I am a novice user of Python . So , if I ask some vague or silly questions please dont mind.
Thanks alot.
s4sarath
 
Posts: 4
Joined: January 31st, 2014, 1:21 am

Re: Python code to send images over xbee s2 ..?

Postby annath » February 4th, 2014, 8:44 am

No problem. If you get stuck on any individual part of that solution I'd be happy to go into further depth.
annath
 
Posts: 26
Joined: December 15th, 2013, 3:50 pm

Re: Python code to send images over xbee s2 ..?

Postby s4sarath » February 5th, 2014, 7:31 am

Hey thanks alot. I have succsefully divide image image into bytes (50 bytes each) and I have packed it again to reconstruct the image. I dint use struct by the way.

But now I am stuck in how to write a code at the receiver side of xbee s2. I tried some code . I tried to send a message and display it on the receiver side , but it is not working . Do you have any suggestions or any informative links ????
s4sarath
 
Posts: 4
Joined: January 31st, 2014, 1:21 am


Return to Help Me! Software

Who is online

Users browsing this forum: No registered users and 1 guest