Esp8266 temp relay and led

hello people !!
i am new in this world and i can understand where is my wrong !
i try to connect the lm35, a virtual relay button and a virtual led but i cant make my code work !! .

#define BLYNK_PRINT Serial    
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <SPI.h>
> char auth[] = "c1d42e9973644c84bf8xxxxxxxxxxx";
> char ssid[] = "o2-WLAN52";
> char pass[] = "0879611112458872";
> float temp;
> int tempPin = 17; // ADC pin
> const int btnPin = 5;
> WidgetLED led5(V5);
> SimpleTimer timer;

> void setup()
> {
>   Serial.begin(9600);
>    Blynk.begin(auth, ssid, pass);
>    pinMode(btnPin, INPUT_PULLUP);
>    while (Blynk.connect() == false)
> {
>   }   
>   timer.setInterval(500L, sendUptime);
>    timer.setInterval(500L, buttonLedWidget);
> }

> boolean btnState = false;
> void buttonLedWidget()
> {
>   // Read button
>   boolean isPressed = (digitalRead(btnPin) == LOW);

>   // If state has changed...
>   if (isPressed != btnState) {
>     if (isPressed) {
>       led5.on();
>     } else {
>       led5.off();
>     }
>     btnState = isPressed;
>   }
> }


> void sendUptime()
> {
>   // You can send any value at any time.
>   // Please don't send more that 10 values per second.
>  
>   Blynk.virtualWrite(10, temp); // virtual pin 10


>  

>  } 
> void loop()
> {
>   Blynk.run(); // Initiates Blynk
>   timer.run(); // Initiates SimpleTimer
>   
>    temp = analogRead(tempPin);
>    temp = temp * 00.9765625; // costance (1/1024*100)
>  delay(500);

put all the commands inside the loop() and put the “delay(500);” and try again

Have you confirmed your hardware is working by logging via serial output?

Do you have a resistor between output and ground?

try not to add codes in the void loop()
This part should go in void sendUptime()

temp = analogRead(tempPin);
temp = temp * 00.9765625; // costance (1/1024*100)

remove the delay(500); and set the timer.setInterval(500L, buttonLedWidget); and the other one to 1000L

and set the V10 widget to push if you are using a display.

hello can work with arduino wifi ?

@sony8943 Please check time date stamps before posting… this topic is over a year old :stuck_out_tongue: