Also hier noch einmal der Vollständige Code. Hatte vorhin nur einen Teil eingefügt.
double sensorPin = A0; // select the input pin for the potentiometer
double sensorValue = 0; // variable to store the value coming from the sensor
int dimled = 8; // pin led to dime
int a; // hilfsvariable berechnung
int b; // prozentualer wert von senorValue (100% = 50)
int Dauer;
void setup()
{
// declare the ledPin as an OUTPUT:
pinMode(dimled, OUTPUT);
}
void loop()
{
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
// turn the ledPin on
sensorValue * 10 = a;
(100/50) * a = b; // prozent Helligkeit
(b/100) * 2 = Dauer;
digitalWrite(dimled, HIGH);
// stop the program for <sensorValue> milliseconds:
delay(Dauer);
// turn the ledPin off:
digitalWrite(dimled, LOW);
// stop the program for for <sensorValue> milliseconds:
delay(2-Dauer);
}
Alle Klammern sind eigentlich da..
Irgendwelche Ideen?