Premier test des neopixel en micropython (chenillard RGB)
This commit is contained in:
parent
3d72fa1fac
commit
3896ba5f3e
48
code/main.py
Normal file
48
code/main.py
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""
|
||||||
|
Eclairage à LED Neopixel
|
||||||
|
"""
|
||||||
|
__author__ = "arofarn"
|
||||||
|
__version__ = 0.1
|
||||||
|
|
||||||
|
import time
|
||||||
|
import machine
|
||||||
|
import neopixel
|
||||||
|
|
||||||
|
NB_NEOPIXEL = 8 # Nombre de pixel
|
||||||
|
|
||||||
|
np = neopixel.NeoPixel(machine.Pin(2), NB_NEOPIXEL)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
for i in range(NB_NEOPIXEL):
|
||||||
|
np[i] = (255, 255, 255)
|
||||||
|
time.sleep(0.5)
|
||||||
|
np.write()
|
||||||
|
for i in range(NB_NEOPIXEL):
|
||||||
|
np[i] = (0, 0, 0)
|
||||||
|
time.sleep(0.5)
|
||||||
|
np.write()
|
||||||
|
for i in range(NB_NEOPIXEL):
|
||||||
|
np[i] = (255, 0, 0)
|
||||||
|
time.sleep(0.5)
|
||||||
|
np.write()
|
||||||
|
for i in range(NB_NEOPIXEL):
|
||||||
|
np[i] = (0, 255, 0)
|
||||||
|
time.sleep(0.5)
|
||||||
|
np.write()
|
||||||
|
for i in range(NB_NEOPIXEL):
|
||||||
|
np[i] = (0, 0, 255)
|
||||||
|
time.sleep(0.5)
|
||||||
|
np.write()
|
Loading…
Reference in New Issue
Block a user