Assignment 10B

Potentiometer

In IRL:

20141028_184904

In Fritzing:

assignment 10B potentiometer fritzing

In Action:

Squeeze Sensor

In IRL:

20141028_185519

In Fritzing:

assignment 10B force sensor 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);
}

Comments are closed.