Arduino MCU have a six Analog Input
in this brief post, I show you how to read Ambient temperature by LM35, it is connected with Analog Input pin A0.

catturaarduino

float tempC;
int reading;
int tempPin = A0;
int temp = 0;
void setup()
{
   //analogReference(INTERNAL);
   Serial.begin(9600);
}

void loop()
{

   //temp = (5.0 * analogRead(tempPin) * 100.0) / 1024;
   temp = analogRead(tempPin)*100*5/1024;
   Serial.print("Temperature ");
   Serial.println(temp);
   delay(2000);
}
Advertisements