-
Notifications
You must be signed in to change notification settings - Fork 181
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
Question re: TimeAlarms #1
Comments
Hi, I’m not familiar library that you are using, but as a guess, I’d say calling Alarm.timerRepeat(60, SendEmail); every second is not what you want to do. Also my library repo doesn’t necessarily have the latest versions of the libraries. You should go to the original sources for the libraries to get the latest versions. regards, John
|
Hi,
Just discovered your Arduino Libraries and thanks for all your work. I am new to arduino so if this is a newbie question please excuse me. I have a project where I need to set an alarm and I am using Alarm.timerRepeat(60, SendEmail); which should trigger every 60 seconds but it will trigger four to five times in a row and then trigger again in 60 seconds again 4-5 times. Below is the sketch that I am using. The sketch is not fully done but I was testing the library to see if it would suit my needs. Thanks again.
/*
Holding Tank Alarm v0.01
Reads an analog input on pin 0, converts it to voltage. If voltage is above 0 volts it sends a text that the
tank needs to be pumped. Connects wirelessly to WiFi in the house. If connection is lost program will continue to try to reconnect to WiFi and sends a text that it has reestablished connection. Program checks RTC on startup and once a month afterwards to set the time.
*/
// add libraries
include <Time.h>
include <TimeAlarms.h>
void setup()
{
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
setTime(22,00,0,1,30,15);
SendEmail();
}
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
// print out the value you read:
Serial.println(voltage);
//display time
digitalClockDisplay();
// wait one second between clock display
Alarm.delay(1000);
// timer for every 60 seconds
Alarm.timerRepeat(60, SendEmail);
}
void digitalClockDisplay()
{
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.println();
}
void printDigits(int digits)
{
Serial.print(":");
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}
void SendEmail()
{
Serial.println("Email sent");
}
The text was updated successfully, but these errors were encountered: