2018-09-10 20:30:17 +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
|
|
|
|
|
2018-11-01 18:37:53 +01:00
|
|
|
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
|
2018-09-10 20:30:17 +02:00
|
|
|
|
2018-11-01 18:37:53 +01:00
|
|
|
pixel_strip = neopixel.NeoPixel(machine.Pin(NEOPIX_PIN), NB_PIX)
|
|
|
|
|
|
|
|
#Eteint tout à l'initialisation
|
2018-11-01 18:39:19 +01:00
|
|
|
pixel_strip.fill((0, 0, 0))
|
2018-11-01 18:37:53 +01:00
|
|
|
pixel_strip.write()
|
2018-09-10 20:30:17 +02:00
|
|
|
|
|
|
|
while True:
|
2018-11-01 18:37:53 +01:00
|
|
|
for i in range(NB_PIX):
|
|
|
|
print("blanc")
|
|
|
|
pixel_strip[i] = (255, 255, 255)
|
|
|
|
pixel_strip.write()
|
2018-09-10 20:30:17 +02:00
|
|
|
time.sleep(0.5)
|
2018-11-01 18:37:53 +01:00
|
|
|
|
|
|
|
for i in range(NB_PIX):
|
|
|
|
print("éteint")
|
|
|
|
pixel_strip[i] = (0, 0, 0)
|
|
|
|
pixel_strip.write()
|
2018-09-10 20:30:17 +02:00
|
|
|
time.sleep(0.5)
|
2018-11-01 18:37:53 +01:00
|
|
|
|
|
|
|
for i in range(NB_PIX):
|
|
|
|
print("rouge")
|
|
|
|
pixel_strip[i] = (255, 0, 0)
|
|
|
|
pixel_strip.write()
|
2018-09-10 20:30:17 +02:00
|
|
|
time.sleep(0.5)
|
2018-11-01 18:37:53 +01:00
|
|
|
|
|
|
|
for i in range(NB_PIX):
|
|
|
|
print("vert")
|
|
|
|
pixel_strip[i] = (0, 255, 0)
|
|
|
|
pixel_strip.write()
|
2018-09-10 20:30:17 +02:00
|
|
|
time.sleep(0.5)
|
2018-11-01 18:37:53 +01:00
|
|
|
|
|
|
|
for i in range(NB_PIX):
|
|
|
|
print("bleu")
|
|
|
|
pixel_strip[i] = (0, 0, 255)
|
|
|
|
pixel_strip.write()
|
2018-09-10 20:30:17 +02:00
|
|
|
time.sleep(0.5)
|