commit ac6b652948f267de98d416021b3fcb31452c686d Author: arofarn Date: Wed Dec 23 17:43:37 2020 +0100 Commit initial diff --git a/CoCuir_Slider.FCStd b/CoCuir_Slider.FCStd new file mode 100644 index 0000000..0a3f335 Binary files /dev/null and b/CoCuir_Slider.FCStd differ diff --git a/CoCuir_Slider.FCStd1 b/CoCuir_Slider.FCStd1 new file mode 100644 index 0000000..74059e7 Binary files /dev/null and b/CoCuir_Slider.FCStd1 differ diff --git a/base.amf b/base.amf new file mode 100644 index 0000000..d72d5f1 Binary files /dev/null and b/base.amf differ diff --git a/poussoir.amf b/poussoir.amf new file mode 100644 index 0000000..12949f2 Binary files /dev/null and b/poussoir.amf differ diff --git a/test_cocuir_slider.py b/test_cocuir_slider.py new file mode 100644 index 0000000..42a5c92 --- /dev/null +++ b/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) + diff --git a/top.amf b/top.amf new file mode 100644 index 0000000..31f1da3 Binary files /dev/null and b/top.amf differ diff --git a/trappe.amf b/trappe.amf new file mode 100644 index 0000000..84cb22b Binary files /dev/null and b/trappe.amf differ