Electronics Primer — Day 3 of 3
'F' → Fullscreen
Start from yesterday's build. Have your Activity 2.2 sheet out: Task 1 needs your resistor reading.
Unplug the USB cable whenever you change the wiring.
With the USB cable unplugged:
GPIO 28, on the top header. The numbers are pin names, not positions.
from machine import Pin
led = Pin(28, Pin.OUT)led.value(1)>>> led.value(0)>>> led.value(1)time.sleep()'s number means. Then put it back to 1.from machine import Pinimport time
led = Pin(28, Pin.OUT)led.value(1)time.sleep(1)led.value(0)Two changes, one at a time. Record what happens, and undo each one before the next.
from machine import Pin
led = Pin(29, Pin.OUT)led.value(1)time.sleep(1) line and run it. What do you see?from machine import Pinimport time
led = Pin(28, Pin.OUT)led.value(1)led.value(0)Neither one is an error. Both programs run to the end and Thonny reports nothing. Say what each one actually did.
Answer the following questions before submitting your work.
led.value(1), about 3.3 V. Explain what led.value(1) actually does to the pin.Pin(29, Pin.OUT), the program ran with no error, but the LED stayed dark. Explain why the computer couldn't tell you anything was wrong.Submit your 2-3-first-light program file and your completed Activity 2.3 sheet.