Worksheets

There are new worksheets for the Half-size line follower on Drive.

We will be having sheets to help you control how your robot behaves. Here's a list of what we will be doing...

  1. Flashing a light. Web Page Google Drive 
  2. Flashing other lights Google Drive
  3. Controlling a motor with the button
  4. Outputting a variable voltage - PWM
  5. Reading a sensor, and displaying the results
  6. Driving motors, and stopping on a line
  7. Following a line. 

Useful Code:
--------------------------------------------------------------------------------------------------------------------------------
# Filename to be printed
Thisfile = "LEDvar.py"
# History

from machine import Pin, PWM, ADC,UART
import time, utime

LEDvar = PWM(Pin(20)) # this does fade only the LED
LEDvar.freq(1000)

#### start here ==========================================
print(Thisfile)
while True:
    count = 0
    while (count <35000):
        count = count+200
        LEDvar.duty_u16(count)
        time.sleep(0.01)

    while (count >0):
         count = count-200
        LEDvar.duty_u16(count)
        time.sleep(0.01)