2018-09-11 17:54:01 +02:00
|
|
|
# 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_PIX = 8 # Nombre de pixel
|
|
|
|
LUMINOSITE = 1.0 # Luminosité (0.0-1.0)
|
|
|
|
NEOPIX_PIN = 2 # N° de la broche de contrôle des néopixels
|
|
|
|
|
|
|
|
pixel_strip = neopixel.NeoPixel(machine.Pin(NEOPIX_PIN), NB_PIX)
|
|
|
|
|
|
|
|
#Eteint tout à l'initialisation
|
2018-09-13 17:45:04 +02:00
|
|
|
pixel_strip.fill((0, 0, 0))
|
2018-09-11 17:54:01 +02:00
|
|
|
pixel_strip.write()
|
|
|
|
|
|
|
|
while True:
|
|
|
|
for i in range(NB_PIX):
|
|
|
|
print("blanc")
|
|
|
|
pixel_strip[i] = (255, 255, 255)
|
|
|
|
pixel_strip.write()
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
|
|
|
for i in range(NB_PIX):
|
|
|
|
print("éteint")
|
|
|
|
pixel_strip[i] = (0, 0, 0)
|
|
|
|
pixel_strip.write()
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
|
|
|
for i in range(NB_PIX):
|
|
|
|
print("rouge")
|
|
|
|
pixel_strip[i] = (255, 0, 0)
|
|
|
|
pixel_strip.write()
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
|
|
|
for i in range(NB_PIX):
|
|
|
|
print("vert")
|
|
|
|
pixel_strip[i] = (0, 255, 0)
|
|
|
|
pixel_strip.write()
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
|
|
|
for i in range(NB_PIX):
|
|
|
|
print("bleu")
|
|
|
|
pixel_strip[i] = (0, 0, 255)
|
|
|
|
pixel_strip.write()
|
|
|
|
time.sleep(0.5)
|