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