Switch
Datastream
How to process switch input on the device
Reading the switch value
BLYNK_WRITE(V1) // this command is listening when something is written to V1
{
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
if (pinValue == 1){
// do something when button is pressed;
} else if (pinValue == 0) {
// do something when button is released;
}
Serial.print("V1 button value is: "); // printing value to serial monitor
Serial.println(pinValue);
}Changing switch state
Change Widget Properties
Properties you can change
Change On/Off labels
Set Button Color
Disable/Enable
Show/Hide
Change widget properties via HTTPs API
Updates the Datastream Property and all assigned Widgets
Path Parameters
Name
Type
Description
Query Parameters
Name
Type
Description
Sync to the latest known state
Last updated
Was this helpful?

