I practiced analog input with potentional meter + arduino kit.

int potPin0 = 0;
int potValue0 = 0;
int led0 = 9;
void setup() {
Serial.begin(9600);
}
void loop() {
potValue0 = analogRead(potPin0) / 4;
analogWrite(led0, potValue0);
Serial.println(potValue0);
delay(10);
}
At first time, I wrote " * 10 / 102 " at that line. It gave me 0 from 100 value, but the LED was little bit darker when 100. I changed it to " / 4 " so that I could get full light.
Next time I will use other sensors. |