Hello to everyone. I just started using blynk. My goal is to make a time-controlled RGB LED controller. What I use for this job:
- Android phone
- Arduino Mega
- Rtc module Ds1302
- Esp 8266 (esp-01)
Virtual pin :
V2: Zergba
V3: Zergba
V4: Zergba
V5: Time input
V6: Time input
V7: Time input
Each time input is connected to a zergba. user will enter time information. When the arduino, ds1302 and time input values are equal, if the start time has come, the rgb led will light in the specified color (zergba),when the stop time comes, the rgb led will turn off.
I couldn’t do it because I’m new, but I studied many projects, videos and articles. But I couldn’t run it. Can you help me please?
Code:
> #define BLYNK_PRINT Serial
> #include <ESP8266WiFi.h>
> #include <BlynkSimpleEsp8266_SSL.h>
> #include <DS1302>
>
>
> // You should get Auth Token in the Blynk App.
> // Go to the Project Settings (nut icon).
> char auth[] = "YourAuthToken";
>
> DS1302 rtc(2,3,4);
> Time t;
>
> BLYNK_CONNECTED() {
> Blynk.syncAll();
> // Synchronize time on connection
>
>
> void setup()
> {
> rtc.writeProtect(false);
> Serial.begin(115200);
> rtc.setDOW(SUNDAY); // Set Day-of-Week
> rtc.setTime(22, 12, 35); // Set the time to 12:00:00 (24hr format)
> rtc.setDate(2, 8, 2020); // tarih
>
> }
> // Debug console
> Serial.begin(115200);
>
> Blynk.begin(auth);
>
> }
>
>
> BLYNK_WRITE(V5) {
> TimeInputParam t(param);
> }
>
> if ((t.hour == RemoteXY.edit_s && t.min == RemoteXY.edit_d))
> {
> Serial.println(String("Start: ") +
> t.getStartHour() + ":" +
> t.getStartMinute() + ":" +
> t.getStartSecond());
> BLYNK_WRITE(V2)
> {
> redValue = param[0].asInt();
> greenValue = param[1].asInt();
> blueValue = param[2].asInt();
>
> analogWrite(RED_PIN, redValue);
> analogWrite(GREEN_PIN, greenValue);
> analogWrite(BLUE_PIN, blueValue);
>
> }
>
> }
>
> if ((t.hour == RemoteXY.edit_s && t.min == RemoteXY.edit_d)
> {
> Serial.println(String("Stop: ") +
> t.getStopHour() + ":" +
> t.getStopMinute() + ":" +
> t.getStopSecond());
> BLYNK_WRITE(V2)
> {
> redValue = param[0].asInt();
> greenValue = param[1].asInt();
> blueValue = param[2].asInt();
>
> analogWrite(RED_PIN, redValue*0);
> analogWrite(GREEN_PIN, greenValue*0);
> analogWrite(BLUE_PIN, blueValue*0);
>
> }
>
> }
>
> // 1. time input
>
> BLYNK_WRITE(V6) {
> TimeInputParam t(param);
> }
>
> if ((t.hour == t.getStartHour() && t.min == t.getStartMinute())
> {
> Serial.println(String("Start: ") +
> t.getStartHour() + ":" +
> t.getStartMinute() + ":" +
> t.getStartSecond());
> BLYNK_WRITE(V3)
> {
> redValue1 = param[0].asInt();
> greenValue1 = param[1].asInt();
> blueValue1 = param[2].asInt();
>
> analogWrite(RED_PIN, redValue);
> analogWrite(GREEN_PIN, greenValue);
> analogWrite(BLUE_PIN, blueValue);
>
> }
>
> }
>
> if ((t.hour == t.getStopHour() && t.min == t.getStopMinute())
> {
> Serial.println(String("Stop: ") +
> t.getStopHour() + ":" +
> t.getStopMinute() + ":" +
> t.getStopSecond());
> BLYNK_WRITE(V3)
> {
> redValue1 = param[0].asInt();
> greenValue1 = param[1].asInt();
> blueValue1 = param[2].asInt();
>
> analogWrite(RED_PIN, redValue*0);
> analogWrite(GREEN_PIN, greenValue*0);
> analogWrite(BLUE_PIN, blueValue*0);
>
> }
>
> }
>
> //2. time input
>
> BLYNK_WRITE(V7) {
> TimeInputParam t(param);
> }
>
> if ((t.hour == t.getStartHour() && t.min == t.getStartMinute())
> {
> Serial.println(String("Start: ") +
> t.getStartHour() + ":" +
> t.getStartMinute() + ":" +
> t.getStartSecond());
> BLYNK_WRITE(V4)
> {
> redValue2 = param[0].asInt();
> greenValue2 = param[1].asInt();
> blueValue2 = param[2].asInt();
>
> analogWrite(RED_PIN, redValue);
> analogWrite(GREEN_PIN, greenValue);
> analogWrite(BLUE_PIN, blueValue);
>
> }
>
> }
>
> if ((t.hour == t.getStopHour() && t.min == t.getStopMinute())
> {
> Serial.println(String("Stop: ") +
> t.getStopHour() + ":" +
> t.getStopMinute() + ":" +
> t.getStopSecond());
> BLYNK_WRITE(V4)
> {
> redValue2 = param[0].asInt();
> greenValue2 = param[1].asInt();
> blueValue2 = param[2].asInt();
>
> analogWrite(RED_PIN, redValue*0);
> analogWrite(GREEN_PIN, greenValue*0);
> analogWrite(BLUE_PIN, blueValue*0);
>
> }
>
> }
>
> //3. time input
>
> }/////bitiş
>
>
> void loop()
> {
>
> Blynk.run();
> }
>
>
I am 15 years old and my english is not good. I’m sorry if I made a mistake. Thank you.