15. November 2011
Dieser LED pulsiert logarithmisch und oszilliert an Hand des Potentiometers schneller oder langsamer:#define sensor_in 0 int potiValue = 0; float tmp; int led_pin = 5; void setup(){ Serial.begin(9600); pinMode(led_pin, OUTPUT); } void loop(){ potiValue = analogRead(sensor_in); Serial.println(); tmp = map(potiValue,0,1023,1,20); for (float i = 1; i<=255; i = i=i*1.4){ analogWrite(led_pin, i); delay(tmp); } for (float i = 254; i>=2; i = i=i/1.4){ analogWrite(led_pin, i); delay(tmp); } }