// This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. #define PWM1 3 // define pwm on pin 3 boolean go = 1; // if 0, will not execute cycling routine // will only set static value in setup() // if 1, will not set static value in setup() // will execute cycling routine in loop() void setup() { pinMode(PWM1, OUTPUT); // set pwm pin as output while(go == 0) { analogWrite(PWM1, 0xff); // change this to set different static values } } void loop() { while(go == 1) { for(int x=0; x<=255; x++) { analogWrite(PWM1, x); delay(25); } delay(100); for(int x=255; x>=0; x--) { analogWrite(PWM1, x); delay(25); } delay(100); } }