Browse Source

Commit initial

master
arofarn 11 months ago
commit
ac6b652948
  1. BIN
      CoCuir_Slider.FCStd
  2. BIN
      CoCuir_Slider.FCStd1
  3. BIN
      base.amf
  4. BIN
      poussoir.amf
  5. 59
      test_cocuir_slider.py
  6. BIN
      top.amf
  7. BIN
      trappe.amf

BIN
CoCuir_Slider.FCStd

BIN
CoCuir_Slider.FCStd1

BIN
base.amf

BIN
poussoir.amf

59
test_cocuir_slider.py

@ -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
top.amf

BIN
trappe.amf

Loading…
Cancel
Save