Example #1
0
def UpDown2():
    servo.position(2, 180)
Example #2
0
import servo
from machine import I2C, Pin
import time

i2c = I2C(-1, scl=Pin(22), sda=Pin(21))

# Create a simple PCA9685 class instance.
servo = servo.Servos(i2c)

servo.position(0, degrees=100)
Example #3
0
def UpDown():
    servo.position(2, 0)
Example #4
0
def UpDown1():
    servo.position(2, 90)
Example #5
0
def ForBack1():
    servo.position(1, 90)
Example #6
0
def ForBack2():
    servo.position(1, 180)
Example #7
0
def OpenClose1():
    servo.position(0, 90)
Example #8
0
def ForBack():
    servo.position(1, 0)
Example #9
0
def OpenClose():
    servo.position(0, 0)
Example #10
0
def LeftRight2():
    servo.position(3, 180)
Example #11
0
def LeftRight1():
    servo.position(3, 90)
Example #12
0
def LeftRight():
    servo.position(3, 0)
Example #13
0
esp.osdebug(None)

import gc

AIN1 = Pin(15, Pin.OUT)
AIN2 = Pin(2, Pin.OUT)
BIN1 = Pin(0, Pin.OUT)
BIN2 = Pin(4, Pin.OUT)

PWMPinA = PWM(Pin(16), freq=980)
PWMPinB = PWM(Pin(17), freq=980)

i2c = I2C(-1, scl=Pin(22), sda=Pin(21))
servo = servo.Servos(i2c)
servo.position(0, degrees=1)
servo.position(1, degrees=1)
servo.position(2, degrees=1)
servo.position(3, degrees=1)


def ModeStop():
    AIN1.off()
    AIN2.off()
    BIN1.off()
    BIN2.off()


def ModeForward():
    AIN1.on()
    AIN2.off()