Assignment 10C : Temperature Sensing
In Fritzing:
In Action:
The Code:
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);
Serial.print("temperature is ");
Serial.println(potVal);
delay(10);
}