#Project objective: Use Sero
#
#Hardware and connections used:
# Servo GND to Raspberry Pi Pico GND
# Servo V+ to Raspberry Pi Pico 3.3 V
# Servo PWM pin to GPIO Pin 15
#
###################################################
#Challenges #
# Use Wowkwi #
# 1) Write a program that sweeps the servo from #
# 0 - 180 - 0
# 2) Write a program that uses a potentiameter to
# to control the Servo.
# - Make sure you map the anologRead to 0 to 180
# 3) Create someting unique using Servos
####################################################
#modules
from picozero import Servo #importing Servo class to easily control the servo motor
from time import sleep
#creating a Servo object
servo = Servo(15)
#continuously pulse the servo arm from min to max position(and vice-verse) for a duration of 1 sec
while True:
for i in range(-180,360):
servo.value=i/180
sleep(0.001)
for i in range(360,-180,-1):
servo.value=i/180
sleep(0.001)