Closed masato1004 closed 1 year ago
@KeioTeamWolvez2023/soft
今のところup
が5.5,down
が2.5の配分が適切だと考えられる.
import RPi.GPIO as GPIO
import sys
import time
class Arm(): def init(self,servo_pin): self.servo_pin = servo_pin
def setup(self):
GPIO.setmode(GPIO.BCM)
self.mode = GPIO.getmode()
# print(mode)
GPIO.setup(self.servo_pin, GPIO.OUT)
self.pwm = GPIO.PWM(self.servo_pin, 50) #電圧を参照するピンを周波数50HZに指定
self.pwm.start(0)
def up(self,buff=0):
self.pwm.ChangeDutyCycle(5.5+buff)
def down(self,buff=0):
self.pwm.ChangeDutyCycle(2.5+buff)
def move(self,ref):
self.pwm.ChangeDutyCycle(ref)
def stop(self):
self.pwm.stop(0)
def calibration(self):
return
アームの適切な操作