Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1251

Python • My RAMPS1.4 doesn't work when controlled by Raspberry PI 5 via Python3

$
0
0
Hello,
When I use my Windows device to control ramps1.4 (mounted on mega Arduino) via Python3, by g code like this:
...

Code:

import serialimport timemyPort = serial.Serial('COM7', 250000, parity='N')time.sleep(1)myPort.write('M302 S0\n'.encode())myPort.write('G1 Z-50 F1000000\n'.encode())myPort.write('M84\n'.encode())
...
everything is good and my step motors work. Next, when I connect this board to my Raspberry Pi5 device and change the 'myPort' code to 'myPort = serial.Serial('/dev/ttyACM0', 250000, parity='N')' connection is established and RAMPS1.4 light flashing to tell us that port is connected but my g code does not work and step motors remain motionless (without any error). First I thought that's issue relates to the Baud rate. So, to solve this problem I tried to change the baud rate in Raspberry Pi 5 via this code 'stty -F /dev/ttyACM0 115200' and checked it again, but that did not work either. Also, I tried any other standard baud rate and failed at all of them. And now, I don't know how to solve it.

Statistics: Posted by civil.shakeri — Mon Mar 18, 2024 12:15 pm



Viewing all articles
Browse latest Browse all 1251

Trending Articles