Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with alarmRepeat not working #10

Open
Lucia416 opened this issue Oct 30, 2021 · 1 comment
Open

Issue with alarmRepeat not working #10

Lucia416 opened this issue Oct 30, 2021 · 1 comment

Comments

@Lucia416
Copy link

Hi there I'm using an ESP32 board NodeMcU32S and Alarm.alarmRepeat doesn't seem to read anything. I am able to read time correctly but can't seem to get the function to read anything.
Could you please take a look at my code and let me know what I'm doing wrong?
Thank you so much in advance:

#include <dummy.h>

#include <TimeAlarms.h>
#include <WiFi.h>
#include <Time.h>
const int output5 = 5;


char* ssid = "RomulanAleSlow";
char* pass = "KehleyrLittleTiger";

AlarmId id;
time_t tnow;

void setup() {
  pinMode(output5, OUTPUT);
  digitalWrite(output5, LOW);
  Serial.begin(115200);
  Serial.println();
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid,pass);
  configTime(0, 0, "0.se.pool.ntp.org");
  setenv("TZ", "UTC+4", 1);
  tzset();
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.print("Clock after Wifi: "); 
  digitalClockDisplay();
  Alarm.alarmRepeat(10,24,0, TurnOnLightTimer);
  Alarm.alarmRepeat(15,25,0, TurnOffLightTimer);
}

void loop() {
  digitalClockDisplay();
  Alarm.delay(1000); 

}

void TurnOnLightTimer() {
  Serial.println("Alarm: - turn lights ON");
  digitalWrite(output5, HIGH);
}

void TurnOffLightTimer() {
  Serial.println("Alarm: - turn lights OFF");
  digitalWrite(output5, LOW);
}

void digitalClockDisplay() {
  tnow = time(nullptr);
  Serial.println(ctime(&tnow));
}
@thisiscam
Copy link

Perhaps you should have included "ESP8266TimeAlarms.h"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants