Commit initial
This commit is contained in:
commit
ac6b652948
BIN
CoCuir_Slider.FCStd
Normal file
BIN
CoCuir_Slider.FCStd
Normal file
Binary file not shown.
BIN
CoCuir_Slider.FCStd1
Normal file
BIN
CoCuir_Slider.FCStd1
Normal file
Binary file not shown.
BIN
poussoir.amf
Normal file
BIN
poussoir.amf
Normal file
Binary file not shown.
59
test_cocuir_slider.py
Normal file
59
test_cocuir_slider.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
#!/bin/python3
|
||||||
|
|
||||||
|
# Script de test pour le projet de slider de CoCuir
|
||||||
|
# 3 boutons dont 2 avec des neopixel intégrés. Le 3e servira de bouton power
|
||||||
|
|
||||||
|
from time import sleep
|
||||||
|
import board
|
||||||
|
import digitalio
|
||||||
|
import neopixel
|
||||||
|
|
||||||
|
# Pinout
|
||||||
|
NPXL_PIN = board.D18
|
||||||
|
|
||||||
|
BUTT_LFT = board.D9
|
||||||
|
BUTT_RGT = board.D11
|
||||||
|
BUTT_PWR = board.D10
|
||||||
|
|
||||||
|
#Colors
|
||||||
|
BLUE = (0,0,255)
|
||||||
|
GREEN = (0,255,0)
|
||||||
|
RED = (255,0,0)
|
||||||
|
WHITE = (200,200,200)
|
||||||
|
BLACK = (0,0,0)
|
||||||
|
|
||||||
|
pixels = neopixel.NeoPixel(NPXL_PIN, 2, auto_write=False)
|
||||||
|
pixels.fill(BLUE)
|
||||||
|
pixels.show()
|
||||||
|
|
||||||
|
button_left = digitalio.DigitalInOut(BUTT_LFT)
|
||||||
|
button_right = digitalio.DigitalInOut(BUTT_RGT)
|
||||||
|
button_power = digitalio.DigitalInOut(BUTT_PWR)
|
||||||
|
|
||||||
|
buttons = [button_left, button_right, button_power]
|
||||||
|
|
||||||
|
for b in buttons:
|
||||||
|
b.direction = digitalio.Direction.INPUT
|
||||||
|
b.pull = digitalio.Pull.UP
|
||||||
|
|
||||||
|
pixels
|
||||||
|
|
||||||
|
while True:
|
||||||
|
print("{} | {} | {}".format(button_left.value, button_right.value, button_power.value))
|
||||||
|
if button_left.value :
|
||||||
|
pixels[0] = GREEN
|
||||||
|
else:
|
||||||
|
pixels[0] = WHITE
|
||||||
|
|
||||||
|
if button_right.value:
|
||||||
|
pixels[1] = BLUE
|
||||||
|
else:
|
||||||
|
pixels[1] = WHITE
|
||||||
|
|
||||||
|
if not button_power.value:
|
||||||
|
pixels.fill(RED)
|
||||||
|
|
||||||
|
pixels.show()
|
||||||
|
|
||||||
|
sleep(0.1)
|
||||||
|
|
BIN
trappe.amf
Normal file
BIN
trappe.amf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user