Catégories
Liens
// SSH * ssh -Y pi@192.168.43.195 // ACCES FILES * sftp://pi@192.168.43.195/home/pi/Documents/malinette/ // DEPOT PATCHES * sftp://pi@192.168.43.195/home/pi/Documents/malinette/malinette-ide/projects/malinette-default/
#include <Stepper.h> const int stepsPerRevolution = 200; Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11); int currentVal; int lastVal; int motorSpeed; void setup() { Serial.begin(9600); } void loop() { int currentval = analogRead(A0); if (currentval >= lastVal + 5 || currentVal <= lastVal + 5) { motorSpeed = map(currentval, 0, 1023, 0, 100); Serial.println(motorSpeed); } lastVal = currentVal; if (motorSpeed < 49) { myStepper.setSpeed( 49 - motorSpeed); myStepper.step(stepsPerRevolution / 100); } else if (motorSpeed > 51) { myStepper.setSpeed( motorSpeed - 51); myStepper.step(-stepsPerRevolution / 100); } }
distribution par panneaux int NB_LEDS_per_P = 13; int P1b[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12}; p1 - Flore bas int P1h[] = { 51,50,49,48,47,46,45,44,43,42,41,40,39}; p1 - Flore haut int P2b[] = { 13,14,15,16,17,18,19,20,21,22,23,24,25}; p2 - Cosmos bas int P2h[] = { 38,37,36,35,34,33,32,31,30,29,28,27,26}; p2 - Cosmos haut
int P3b[] = { 26,27,28,29,30,31,32,33,34,35,36,37,38}; p3 - Faune bas int P3h[] = { 25,24,23,22,21,20,19,18,17,16,15,14,13}; p3 - Faune haut int P4b[] = { 39,40,41,42,43,44,45,46,47,48,49,50,51}; p4 - Sapiens bas int P4h[] = { 12,11,10,9,8,7,6,5,4,3,2,1,0}; p4 - Sapiens haut
int Menu[] = { 60,61,62,63,65,66}; Menu Zen / accueil / Jeu (par groupe de 2 leds)
int *curr_Pxb; int *curr_Pxh;
int currentZenHue; int hues[] = { 50, 100, 200 }; default hue values int currentFPS = 80; void setup() { delay(2000); delay for recovery
// Setup leds array FastLED.addLeds<LED_TYPE, 2, COLOR_ORDER>(leds[0], NUM_LEDS).setCorrection(TypicalLEDStrip); FastLED.addLeds<LED_TYPE, 3, COLOR_ORDER>(leds[2], NUM_LEDS).setCorrection(TypicalLEDStrip); FastLED.addLeds<LED_TYPE, 4, COLOR_ORDER>(leds[1], NUM_LEDS).setCorrection(TypicalLEDStrip);
// Setup color par panneaux for (int i = 0; i < NB_LEDS_per_P; i++) { // P1 Flore leds[0][P1b[i]] = CRGB::Green; leds[1][P1h[i]] = CRGB::Green; // P2 Cosmos leds[0][P2b[i]] = CRGB::White; leds[1][P2h[i]] = CRGB::White; // P3 Faune leds[0][P3b[i]] = CRGB::Yellow; leds[1][P3h[i]] = CRGB::Yellow; // P4 Sapiens leds[0][P4b[i]] = CRGB::Blue; leds[1][P4h[i]] = CRGB::Blue; // FastLED.setBrightness(10); } // MENU ZEN leds[1][60] = CRGB::Blue; leds[1][61] = CRGB::Blue; // MENU MED leds[1][62] = CRGB::White; leds[1][63] = CRGB::White; // MENU JEU leds[1][65] = CRGB::Red; leds[1][66] = CRGB::Red; // FastLED.setBrightness(10); FastLED.show();
// Serial communication Serial.begin(BAUD_RATE);
}
</code >