#include uint32_t Wheel(byte WheelPos,byte brightness=255); const int PWM_PIN=5; const int BTN_PIN=3; const int PWM_FB =A1; const int POT_PIN = A0; const int LED_PIN = 2 ; int pwm = 10; int target = 400; //target voltage for step up : 5V int hysteresis = 3; Adafruit_NeoPixel strip = Adafruit_NeoPixel(6, LED_PIN, NEO_GRB + NEO_KHZ800); void setup(){ pinMode(PWM_PIN,OUTPUT); setPwmFrequency(PWM_PIN, 1); analogWrite(PWM_PIN,pwm); analogReference(INTERNAL); strip.begin(); strip.show(); Serial.begin(9600); } uint16_t counter=0; uint16_t scaler=20; void loop(){ // ********************* // // Fin de régulation // // ********************* // // rainbow int init=0; int prescale=0; while(digitalRead(BTN_PIN) == LOW){ regul_tension(); int pot = analogRead(POT_PIN); rainbow((init+255-(10*pot)>>2)%255); if(prescale++==800) prescale=0; init++; delay(200); } uint16_t i; for(i=0; i<20; i++) delay(500); // one color while(digitalRead(BTN_PIN) == LOW){ regul_tension(); int pot = analogRead(POT_PIN); uint16_t i; for(i=0; i>2)); } strip.show(); delay(500); } for(i=0; i<20; i++) delay(500); // girophare float angle=0; while(digitalRead(BTN_PIN) == LOW){ regul_tension(); int pot = analogRead(POT_PIN); for(i=0; i>2,b)); } strip.show(); angle = (angle+1); if(angle==180) angle = 0; delay(200); } for(i=0; i<20; i++) delay(500); // lumière blanche while(digitalRead(BTN_PIN) == LOW){ regul_tension(); int pot = analogRead(POT_PIN); for(i=0; i>2,pot>>2,pot>>2)); } strip.show(); delay(1); } for(i=0; i<20; i++) delay(500); } void rainbow(uint16_t j) { uint16_t i; for(i=0; itarget+hysteresis){ if(pwm>0) pwm--; } else if(value