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:

  1. Connect to your Little Python Brain using a tablet
  2. Go to the Blocks IDE
  3. Import the neopixel, sleep, and Pin libraries
  4. Set up the neopixel
  5. 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()!
  6. 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)
Bookmark(0)

No account yet? Register

2+
0 Comments

Leave a reply

© 2020 Little Python

CONTACT US

    Log in with your credentials

    or    

    Forgot your details?

    Create Account