Difference between revisions of "LED Ring NeoPixel"

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search
(Created page with "= Description = Text Image(s) = How to connect it electrically = Text Image(s) = How to control it in MicroPython = <syntaxhighlight lang="python" line='line'> # todo #...")
 
Line 12: Line 12:
 
= How to control it in MicroPython =
 
= How to control it in MicroPython =
 
<syntaxhighlight lang="python" line='line'>
 
<syntaxhighlight lang="python" line='line'>
# todo
+
import neopixel
# code goes here
+
from machine import Pin
 +
 
 +
# number of leds
 +
n=8
 +
# connected Pin
 +
p=0
 +
 
 +
np = neopixel.NeoPixel(Pin(p),n)
 +
 
 +
# sets color of the led at position 0 to (r,g,b)
 +
np[0] = (255,0,0)
 +
# colors the leds
 +
np.write()
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 11:29, 19 August 2020

Description

Text

Image(s)


How to connect it electrically

Text

Image(s)

How to control it in MicroPython

 1 import neopixel
 2 from machine import Pin
 3 
 4 # number of leds
 5 n=8
 6 # connected Pin
 7 p=0
 8 
 9 np = neopixel.NeoPixel(Pin(p),n)
10 
11 # sets color of the led at position 0 to (r,g,b)
12 np[0] = (255,0,0)
13 # colors the leds
14 np.write()

A small Program in MicroPython

1 # todo 
2 # code goes here

text

image(s)

Related Tutorial Videos

change to the right video


Background

text

image(s)