I would like to start by saying that I am rather new to Raspberry Pi, but I have programmed Arduino. At the moment I am trying to get a Pi Zero W to transfer a JPG over serial using python and the Adafruit Console cable. I followed these instructions to setup the serial connection and it works great: https://www.instructables.com/id/Read-and-write-from-serial-port-with-Raspberry-Pi/. I have been looking for help with how to alter the code so that I can copy a JPG and send it via serial from the Zero W to the 3B+. Here is what I tried:
On the Zero side (transmit):
shutil.copyfileobj(open('/locaton/of/image.jpg', 'rb'), my_serial_portinfo)
my_serial_portinfo.write(open('/location/of/image.jpg','rb').read())
Both of these options seem to be just sitting when I run the code; almost like nothing is happening or it is waiting. my_serial_portinfo includes all the information that is needed for the serial port.
On the 3B+ side (recieving):
shutil.copyfileobj(mu_serial_portinfo, '/location/to/place/jpg')
my_serial_portinfo.read(X)
(I have placed a variety of byte sizes here to see if it changes anything) This does nothing but returns a statement of:
program exiting with code: 0
My python code has only one of the lines that I have mentioned above and the required information for the serial port.
Can anyone help me? Is there a way to easily move a file from my Zero W to my 3B+ over serial. I originally started trying to do this with an USB ethernet connection (setting up the Zero as a gadget) and had a terrible time with it. If I cannot get help I might have to switch back and seek more help.
ftp
is much easier. – Milliways Apr 29 '19 at 00:18Serial to Arduino totally non-responsive - 2019 https://raspberrypi.stackexchange.com/questions/96184/serial-to-arduino-totally-non-responsive/96264#96264
– tlfong01 Apr 29 '19 at 02:27