/* Sketch generated by the Arduino IoT Cloud Thing "Untitled 2" create.arduino.cc/cloud/things/ceeec7a4-b3ce-484a-a5b3-e58ed768d3fa Arduino IoT Cloud Variables description The following variables are automatically generated and updated when changes are made to the Thing CloudSwitch _switch_; Variables which are marked as READ/WRITE in the Cloud Thing will also have functions which are called when their values are changed from the Dashboard. These functions are generated with the Thing and added at the end of this sketch. */ #include "thingProperties.h" #define RelayPin1 0 //D3 #define wifiLed 16 int toggleState_1 = 0; void setup() { // Initialize serial and wait for port to open: Serial.begin(9600); // This delay gives the chance to wait for a Serial Monitor without blocking if none is found delay(1500); // Defined in thingProperties.h initProperties(); // Connect to Arduino IoT Cloud ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/* The following function allows you to obtain more information related to the state of network and IoT Cloud connection and errors the higher number the more granular information you’ll get. The default is 0 (only errors). Maximum is 4 */ setDebugMessageLevel(2); ArduinoCloud.printDebugInfo(); pinMode(RelayPin1, OUTPUT); pinMode(wifiLed, OUTPUT);
digitalWrite(RelayPin1, HIGH);
} void loop() { ArduinoCloud.update(); // Your code here if (WiFi.status() !=WL_CONNECTED) { digitalWrite(wifiLed, HIGH);
} else{ digitalWrite(wifiLed, LOW); } } /* Since Switch is READ_WRITE variable, onSwitchChange() is executed every time a new value is received from IoT Cloud. */ void onSwitchChange() { // Add your code here to act upon Switch change if (_switch_ == 1) { digitalWrite(RelayPin1, LOW); Serial.println("Device ON") toggleState_1 = 1; } else { digitalWrite(RelayPin1, HIGH); Serial.print("Device OFF"); toggleState_1 = 0; }
the code is working but when i turned off the switch it clicks but when i turn it on again it doesnt work. i need to touch the relay module before it turned on again hehe. Please help whats the problem.
There is no link for the code in the description. can you send it to me pls?
how to get the code?
The link is an advertisement for music, please upload it again, thank you
hello video creater can you sent the code that you says you will provide in the discription please thankyou
where is it ?
More vids po. More power❤️
It Can works without Arduino Ide
give the code you pasted
where the code?
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled 2"
create.arduino.cc/cloud/things/ceeec7a4-b3ce-484a-a5b3-e58ed768d3fa
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
CloudSwitch _switch_;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
#define RelayPin1 0 //D3
#define wifiLed 16
int toggleState_1 = 0;
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
pinMode(RelayPin1, OUTPUT);
pinMode(wifiLed, OUTPUT);
digitalWrite(RelayPin1, HIGH);
}
void loop()
{
ArduinoCloud.update();
// Your code here
if (WiFi.status() !=WL_CONNECTED)
{
digitalWrite(wifiLed, HIGH);
}
else{
digitalWrite(wifiLed, LOW);
}
}
/*
Since Switch is READ_WRITE variable, onSwitchChange() is
executed every time a new value is received from IoT Cloud.
*/
void onSwitchChange() {
// Add your code here to act upon Switch change
if (_switch_ == 1)
{
digitalWrite(RelayPin1, LOW);
Serial.println("Device ON")
toggleState_1 = 1;
}
else
{
digitalWrite(RelayPin1, HIGH);
Serial.print("Device OFF");
toggleState_1 = 0;
}
}
Heyy I Wana Do this project so I Need some help of you how cam I contact with you
kale_shreyash_ contact me here
the code is working but when i turned off the switch it clicks but when i turn it on again it doesnt work. i need to touch the relay module before it turned on again hehe. Please help whats the problem.
@@Life_is_a_Gift-t8x see the connections.
get rid of the 'music'