Added Labo RC Car Light FX
This commit is contained in:
parent
b279d986b3
commit
cd23946642
1 changed files with 21 additions and 0 deletions
21
Labo_RC_Car_Light_FX/code.py
Normal file
21
Labo_RC_Car_Light_FX/code.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from adafruit_circuitplayground.express import cpx
|
||||
import board
|
||||
import neopixel
|
||||
|
||||
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.1, auto_write=True)
|
||||
pixels.fill(0)
|
||||
|
||||
while True:
|
||||
|
||||
x_float, y_float, z_float = cpx.acceleration # read acceleromter
|
||||
r, g, b = 0, 0, 0
|
||||
|
||||
if abs(x_float) > 4.0:
|
||||
r = 255
|
||||
if abs(y_float) > 2.0:
|
||||
g = 255
|
||||
if z_float > -6.0 or z_float < -12.0:
|
||||
b = 255
|
||||
|
||||
pixels.fill((r,g,b))
|
||||
|
||||
Loading…
Reference in a new issue