Assignment 10B
Potentiometer
In IRL:
In Fritzing:
In Action:
Squeeze Sensor
In IRL:
In Fritzing:
In Action:
I used the same code for both, described here:
const int ledPin = 9;
const int potReader = A0;
void setup(){
pinMode(ledPin, OUTPUT);
pinMode(potReader, INPUT);
}
void loop(){
int potVal = analogRead(potReader);
int ledVal = potVal * 255.0 / 1024;
analogWrite(ledPin, ledVal);
delay(10);
}