Skip to content

Lab 12 Scan Code #77

@ClarkG77

Description

@ClarkG77

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions