45 lines
807 B
C++
Executable File
45 lines
807 B
C++
Executable File
//nota BABYLON. AL SALIR DE LA PANTALLA PRINCIPAL
|
|
// FLAG RIEGO para desactivarlo.
|
|
|
|
#define LEDtop 9
|
|
#define LEDmid 10
|
|
#define LEDbot 11
|
|
#define POT A1
|
|
#define BTN1 3
|
|
#define BTN2 4
|
|
#define BTN3 5
|
|
#define BTN4 6
|
|
int pot;
|
|
|
|
void setup() {
|
|
pinMode(LEDtop, OUTPUT);
|
|
pinMode(LEDmid, OUTPUT);
|
|
pinMode(LEDbot, OUTPUT);
|
|
pinMode(BTN1, INPUT);
|
|
pinMode(BTN2, INPUT);
|
|
pinMode(BTN3, INPUT);
|
|
pinMode(BTN4, INPUT);
|
|
pot=0;
|
|
}
|
|
|
|
void loop() {
|
|
dimmer(LEDtop);
|
|
}
|
|
|
|
void dimmer(byte LED) {
|
|
pot = analogRead(POT);
|
|
pot = map(pot, 0, 1023, 0, 255);
|
|
analogWrite(LED, pot);
|
|
}
|
|
|
|
void fxRes(byte LED) {
|
|
for (byte i=20; i<255; i++) {
|
|
analogWrite(LED, i);
|
|
delay(5);
|
|
}
|
|
for (byte i=255; i>20; i--) {
|
|
analogWrite(LED, i);
|
|
delay(5);
|
|
}
|
|
}
|