const int potPin = A0;
int potValue = 0;
void setup() {
DDRD |= (1 << 2);
DDRD |= (1 << 3);
DDRD |= (1 << 4);
DDRD |= (1 << 5);
Serial.begin(9600);
}
void loop() {
potValue = analogRead(potPin);
Serial.println(potValue);
delay(100);
switch (potValue / 204) {
case 1:
{
PORTD |= (1 << 2);
PORTD &= ~(1 << 3);
PORTD &= ~(1 << 4);
}
break;
case 2:
{
PORTD &= ~(1 << 2);
PORTD &= ~(1 << 4);
PORTD |= (1 << 3);
}
break;
case 3:
{
PORTD &= ~(1 << 2);
PORTD &= ~(1 << 3);
PORTD |= (1 << 4);
}
break;
default:
{
PORTD &= ~(1 << 2);
PORTD &= ~(1 << 3);
PORTD &= ~(1 << 4);
}
break;
}
}