LED Control using Raspberry Pi Pico W and coded with Arduino IDE

So basically, I am trying to delve into IoT using Blynk. This mini project main purpose is to turn on and off using Blynk. Currently I have set up the connection using GP1 and GND1 for the external LED. On a side note, I followed guidance from YouTube regarding on how to setup the Blynk, I have created new template, DataStream, and Dashboard. I ran into issues with the code where I can’t find the right library to include to run the project. Any help and assistance are much appreciated.

#define BLYNK_TEMPLATE_ID "###"
#define BLYNK_TEMPLATE_NAME "###"
#define BLYNK_AUTH_TOKEN "###"

#include <WiFi.h>               // WiFi library for Pico W
#include <BlynkSimpleEsp32.h>   // Blynk library compatible with Pico W

// Wi-Fi credentials
const char* ssid = "###";
const char* password = "###";

// GPIO pin for the LED
const int ledPin = 2; // GPIO 2

void setup() {
  // Initialize Serial Monitor
  Serial.begin(115200);

  // Initialize LED pin as output
  pinMode(ledPin, OUTPUT);

  // Turn off LED initially
  digitalWrite(ledPin, LOW);

  // Connect to Wi-Fi
  Serial.println("Connecting to Wi-Fi...");
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("\nConnected to Wi-Fi");
  Serial.print("IP Address: ");
  Serial.println(WiFi.localIP());

  // Connect to Blynk
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, password);
  Serial.println("Connected to Blynk");
}

void loop() {
  Blynk.run(); // Handle Blynk connection
}

// Virtual pin V0 controls the LED
BLYNK_WRITE(V0) {
  int value = param.asInt(); // Get value from Blynk app
  digitalWrite(ledPin, value); // Set LED state
  Serial.print("LED: ");
  Serial.println(value ? "ON" : "OFF");
}

@Fawwaz Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Copy and paste these if you can’t find the correct symbol on your keyboard.

Pete.

Thanks for the reply Mr. PeteKnight, I’ve added the triple backticks.

I’ve never used the Pico W (mostly because I don’t see it a a great choice of IoT device) but as far as I’m aware it can’t be programmed using C++ without some sort of emulation software.
The device is t on Blynk’s list of supported hardware.

You’d be better using an ESP32 in my opinion.

Pete.

Again, thanks for the reply Mr. Pete, I’ve done the research and came up with the same outcome which the Pico W can’t be programmed to use with Blynk. I’ve tried using Arduino IDE and html and it works fine. I guess it’s best to continue this project using Python. On a side note, this project is for one of my classes in Embedded Systems, and it is required to use Raspberry Pi as the MC, and since I want to delve into IoT Pico W is what I decided to use. Thanks for your guidance Mr. Pete.

Fawwaz.

You don’t seem to understand exactly what Blynk is.

It is possible to use the Pico W with Blynk, if you use the Blynk Python library, but that isn’t very well supported.
If you have Python programming skills then Blynk isn’t out of the question.

However, you also need to understand the limitations of the Blynk free account, with its 30,000 message limit each month, which may make it unsuitable for your needs.

Pete.