#include SoftwareSerial monserial(1, 0); // rx and tx float tempC; // Variable to store the value obtained from the sensor (0 to 1023) int pinLM35 = 3; int led = A2; int msg; void setup() { // We configure the serial port to 9600 bps. monserial.begin(9600); pinMode(led,OUTPUT); } void loop() { if (monserial.available()){ msg=monserial.read(); if(msg== 2){ analogWrite(led,1023); delay(500); msg=monserial.read(); }} else{ analogWrite(led,0); } tempC = analogRead(pinLM35); // Read the signal from LM35 PIN tempC = (5.0 * tempC * 100.0)/1024.0; // Transform into Celcius monserial.println(tempC); delay(1000);}