0

I currently have a python script that works perfectly for 180 Servo. I have to run from my Windows computer because the model is stored here. So I'm sending the Pi a command via gpiozero.

from gpiozero import Servo
from gpiozero.pins.pigpio import PiGPIOFactory 

Model = Load Model

factory = PiGPIOFactory(host='10.0.0.164')
myCor = .0
servo = Servo(17,min_pulse_width= (1.0 + myCor)/1000,max_pulse_width=(2.0 + myCor)/1000,pin_factory=factory)
servo.value = 0

if A = B:
     servo.value = 1
elif:
    servo.value = -1

** PROBLEM**

I bought a continuous motor now and the current code only allows values of -1 to 1, 180 degree control vs. 360.

I want to remotely send this command to my raspberry pi from my Windows computer.

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
p = GPIO.PWM(17, 50)
p.start(7.5)
try:
        while True:
                p.ChangeDutyCycle(7.5)
                time.sleep(1)
                p.ChangeDutyCycle(12.5)
                time.sleep(1)
                p.ChangeDutyCycle(2.5)
                time.sleep(1)

except KeyboardInterrupt:
        GPIO.cleanup()

I've seen a lot of posts about using paramiko, ssh, or a socket but I haven't been able to set it up. I do have Putty installed and I can connect. However, that just brings up the Pi command window. It doesn't create the "connection" that my Python code can use.....

How can I send a command as seamlessly as I could using GPIOZero? Any help is appreciated!

user2607686
  • 47
  • 2
  • 8

0 Answers0