Stap 5: Codes
void setup()//code 1
{ Serial.begin(9600); }
void loop()
{Serial.println(analogRead(0)); delay(500);} / / / / < p > int sens = 0; code 2 < br > void setup {Serial.begin(9600); < /p >< p >} { Serial.println(analogRead(0)); delay(500); } // // // <p>int sens = 0; //code 2<br>void setup() { Serial.begin(9600);</p><p>} void loop() { int val = analogRead(sens); val = constrain( val,32,118); int ledval = map(val,32,118,255,0); Serial.println(ledval); delay(500); }</p>// // // <p>int led = 12; // code 3<br>int sens = 0; void setup() { pinMode(led,OUTPUT); } void loop() { int val = analogRead(sens); val = constrain( val,20,190); int ledval = map(val,20,190,255,0); analogWrite(led,ledval); }</p> {int val = analogRead(sens); val = beperken (val, 32, 118); int ledval = map(val,32,118,255,0); Serial.println(ledval); delay(500); } < /p > / / / / / / < p > int led = 12; code 3 < br > int sens = 0; void setup {pinMode(led,OUTPUT);}