BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Led dimming on Esp32 devkit

Hello all!

I am trying to control the brightness of builtin led on Esp32 devkit, by Google assistant commands say " set led brightness to 50%". I am able to switch ON/Off the led but having trouble with webhooks to control the brightness. What parameters to be used while creating applet?

I have searched a lot but no result.

What have you tried so far, and what code are you using on your ESP32?

Pete.

Hello Pete,

Please find below the example used from Blynk Arduino library.

  1. With the basic example code and creating applets i was able to turn on and off led by voice command.
  2. i added some lines to work with Slider widget in Blynk app, it worked as desired.

I wanted to control the brightness by voice command on google assistant which is where i am getting stuck. I am not much into coding so not sure where i am wrong. Is it the program code or the applet parameters…please assist.

Thankyou,
Minesh

#define BLYNK_PRINT Serial


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

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "FMC8WkLghPgIxw0RTHpImlTrXCi7aIgN";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "MAURYA";
char pass[] = "8767510562@aalok";
int led = 2;
int pinValue;

BLYNK_WRITE(V0)
{
  pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
  ledcWrite(0, pinValue);
  // process received value
}

void setup()
{
  // Debug console
  ledcSetup(0, 12000 ,8);
  // attach the channel to the GPIO to be controlled
  ledcAttachPin(led, 0);
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}

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

I suspect you are using IFTTT.
Use the google assistant trigger (THIS), use “phrase with a number”.
For the action (THAT) use webhook. Use the URL in the format shown below. number field is selected from the insert ingredients option.

http://blynk-cloud.com/Auth_Token/update/V0?value=numberfield

Thanks a ton! It is working now :relaxed: I was using just " http://blynk-cloud.com/Auth_Token/update/V0 "

Regards,
Minesh