Introduction
This project does a pretty simple task: it blinks between red and yellow in 0.3s intervals!
Components Needed
- A Little Python Brain
- A tablet/phone/computer
How To Build:
- Connect to your Little Python Brain using a tablet
- Go to the Blocks IDE
- Import the neopixel, sleep, and Pin libraries
- Set up the neopixel
- Create your loop!
- You can build your loop using a while True block or a while condition block. Use whatever you prefer!
- Make sure to add a sleep(0.3) after each np.write()!
- Run the code!
The Code
import neopixel from time import sleep from machine import Pin np = neopixel.NeoPixel(Pin(12), 1) while Pin(0, Pin.IN, Pin.PULL_UP).value(): np[0] = (102, 0, 0) # Colour = #660000 np.write() sleep(0.3) np[0] = (102, 102, 0) # Colour = #666600 np.write() sleep(0.3)
2+