from pybricks.hubs import TechnicHub
from pybricks.pupdevices import Motor
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop
from pybricks.robotics import DriveBase
from pybricks.tools import wait, StopWatch

#GBC 53 Marble Music Machine - Hub1
hub = TechnicHub()

#Initialize motors
motor_vertical_conveyor_lift = Motor(Port.A)
motor_programming_wheel = Motor(Port.C, Direction.COUNTERCLOCKWISE)
motor_ball_divider = Motor(Port.D)


#Start motors
motor_vertical_conveyor_lift.dc(25)
wait(500)
motor_programming_wheel.dc(40) #do not reverse!
wait(500)


#Start loop
while True:
	
	#Syntax is (Speed, Time ms, Then, Wait)
	motor_ball_divider.run_time(300, 4000, Stop.HOLD, True) #to the left
	wait(2000)
	motor_ball_divider.run_time(-100, 500, Stop.HOLD, True)
	wait(2000)
	motor_ball_divider.run_time(-100, 500, Stop.HOLD, True)
	wait(2000)
	motor_ball_divider.run_time(-100, 500, Stop.HOLD, True)
	wait(6000)
	motor_ball_divider.run_time(-100, 500, Stop.HOLD, True)
	wait(2000)
	motor_ball_divider.run_time(-100, 500, Stop.HOLD, True)
	wait(2000)
	motor_ball_divider.run_time(-100, 500, Stop.HOLD, True)
	wait(2000)


    

