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
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.