javaplus / PicoProjects

74 stars 11 forks source link

Lab 12 Scan Code #77

Open ClarkG77 opened 7 months ago

ClarkG77 commented 7 months ago

Looks like the servo pin attribute isn't apart of the sg_90 library anymore. I am suggesting a change to the lab code to avoid using that seems the other code was updated but not the scan one.

import utime
import sg90 import servo

servo1 = servo(15)

SMOOTH_TIME = 20

def scan():
    for i in range(90,180):
        servo1.move_to(i)
        utime.sleep_ms(SMOOTH_TIME)

    for i in range(180,89, -1):
        print(i)
        servo1.move_to(i)
        utime.sleep_ms(SMOOTH_TIME)

    for i in range(90,-1,-1):
        servo1.move_to(i)
        utime.sleep_ms(SMOOTH_TIME)

    for i in range(0,91):
        print(i)
        servo1.move_to(i)
        utime.sleep_ms(SMOOTH_TIME)

servo1.move_to(90)

while True:
    scan()
javaplus commented 7 months ago

If you can open a pull request. I'll add you as a collaborator.