#define LEDtop 9 #define LEDmid 10 #define LEDbot 11 #define POT A1 int pot; void setup() { pinMode(LEDtop, OUTPUT); pinMode(LEDmid, OUTPUT); pinMode(LEDbot, OUTPUT); 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); } }