Home/Support/Support Forum/File Transfer (From PC To Raspberry Pi)
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

File Transfer (From PC To Raspberry Pi)

0 votes
Hey,

I've two xBee Pro S2C module. I'm trying to send a image from Windows PC to Raspberry Pi with xBee modules. I configured my xBees for API mode and i can receive/send AT text messages with Python codes.

I want to send a image from my PC to Raspberry Pi Model 3 B+

I also checked this subject: http://cms.digi.com/support/forum/70518/transfer-image-between-xbee-modules-connected-raspberry-each

I made some changes and tried codes below.

PC side(sender)
###########################
ser = serial.Serial('COM6', 9600,timeout=.5)
fc= 'xbee.jpg'
File = open(fc,'r')
#while True:
line = ser.readline()
a= File.read()
print(str(a))
ser.write(str(a))
#############################





Raspberry Pi side (receiver)
#############################

ser = serial.Serial('/dev/ttyUSB0', 9600,timeout=.5)

while True:
incoming = ser.readline().strip()


file = open ('images.png','wb')

print (incoming)
file.write(incoming)
file.close()
content= file.read()

#################################


Then i got a error:

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 240: character maps to <undefined>


Also an idea came to my mind. I made a script converts an image to base64 code and saves as a .txt file. I changed "images.png" as "test.txt". There is no error occured but also there is no .txt file created on my raspberry pi.
asked Aug 24 in 3rd Party Python and API development in other Languages by highpriv New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
This is not an issue for the XBee but for your Python or Arduino group.
answered Aug 24 by mvut Veteran of the Digi Community (13,318 points)
...