/*************************************************************

  This is a simple demo of sending and receiving some data.
  Be sure to check out other examples!
 *************************************************************/

/* Fill-in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID           "TMPL6dHfnNlU1"
#define BLYNK_TEMPLATE_NAME         "Quickstart Device"
#define BLYNK_AUTH_TOKEN            "SPMfNNv2OMY-Qt8yDh8e3h6u81NQg_Ed"

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wokwi-GUEST";
char pass[] = "";
#define LED_PIN 18// Pin to which the LED is connected


BLYNK_WRITE(V0) { // This function gets called when the Button Widget in the app changes state
  int ledState = param.asInt(); // Get the state of the button (0 or 1)
  digitalWrite(LED_PIN, ledState); // Set the LED based on the button state
}

void setup() {
  Serial.begin(115200);
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  Blynk.run();
}