// https://www.arduino.cc/reference/en/language/structure/control-structure/for/
const int PWM_PIN = 6;
void setup() {
Serial.begin(9600);
Serial.println("Count up to 255 by 5");
for (int i = 0; i <= 255; i += 5) {
Serial.println(i);
}
Serial.println("\nLogarithmic progression");
for (int x = 2; x < 500; x = x * 1.5) {
Serial.println(x);
delay(100);
}
Serial.println("\nNow fade up and down forever...");
}
void loop() {
///*
int x = 1;
for (int i = 0; i > -1; i = i + x) {
analogWrite(PWM_PIN, i);
if (i == 255) {
x = -1; // switch direction at peak
}
delay(10);
}
//*/
}