Use this tag for questions regarding how to get the time on an Arduino, how to create or use clocks with an Arduino, or anything that has time as a substantial factor in it. Also consider using [programming] or other more specific tags.

learn more… | top users | synonyms

0
votes
2answers
16 views

Arduino creating delay function

I am trying to make my own delay function. Briefly mydelay function is calling toggled function every secs seconds. The code is not well written, i know (this is the first version). But i am just ...
0
votes
0answers
17 views

Options for turning on/off an output at a specific time?

I am building a night light that will turn on when it detects motion using a Passive Infrared (PIR) sensor. I only want the light to turn on overnight, between specific hours that I specify. Outside ...
-1
votes
1answer
23 views

How to speed up writing a file to a WifiClient?

I'm working with a Realtek Ameba IoT RTL8195 board that's compatible to Arduino. I have a text file on an SD card that I want to send via HTTP over wifi, with the Ameba acting as a server. I ...
3
votes
2answers
41 views

Format hour and minute integers to HH:MM format (char*)

In Arduino code, I'm calling the getTextBounds() and print() API methods on my TFT handler object which accepts char* parameters and I have two integers holding a specific time's hour and minute part, ...
3
votes
1answer
61 views

Comparing time_t values within an if statement

I am using an UNO with a RTC to control a light board. I'm using a simple control structure to decide when to turn things off and on. It's my understanding that a time_t value is just a number (number ...
5
votes
4answers
225 views

How to keep accurate millis() while using ADC_sleep mode?

millis() uses timer0 (linked to CPU clock) to count time, but ADC_sleep mode stops the CPU clock, therefore millis() will drift (lag behind) after each ADC conversion performed in ADC_sleep mode. ...
1
vote
2answers
74 views

How to improve date-time control from RTC?

I want to run cameras at a remote site from external batteries as long as possible. I need power-miser Arduino to switch battery power on/off at set intervals (e.g. 5 min) during daytime only. I am a ...
2
votes
4answers
262 views

Is there any way I can stop the Arduino Mega 2560 from resetting all variables after losing and reconnecting power?

I am using an Arduino Mega 2560 board. I have tried connecting a 115 Ω resistor from 5V to Reset, and 10 µf capacitor form reset to GND (to disable autoreset), and the variables still seem ...
0
votes
2answers
72 views

How much time does the Arduino need to call a Function or to read a Variable?

How much time does an Arduino Uno or Mega need to only call a function. And how does the time change if this function is inside a Class, for example inside a Library? The same thing for a variable. ...
0
votes
4answers
39 views

Ignore event until x minutes

I have an arduino where I looking for an input event then do something. Unfortunately this input event can occur like 200 times and I only care about the first notification. Since I have a DS1302 ...
0
votes
1answer
30 views

Arduino servo seems to time out after code runs for some amount of time

I am running a simple servo program that swings the servo back and forth, it is essentially pressing a button continuously. However, after some time the servo stops moving and it seems like the code ...
0
votes
0answers
46 views

Using a DS1307 as a Counter

I am using Arduino UNO and have attached DS1307 board to it. How can I use DS1307 RTC IC as a time counter, rather than time keeper? Any ideas?
0
votes
2answers
54 views

using millis() for a timer

Basically the user presses a button and cycles thru 3 different modes. Mode 1 the LED is on, mode 2 the LED is off and mode 3 the LED is kept on for a certain amount of time. I'm using the millis() to ...
1
vote
1answer
41 views

Record a duration of time as data

I have very little experience with the ardunio and am hoping that you may provide me with some helpful info. I would like to build a device that records time spent on a project. I envision the main ...
1
vote
1answer
106 views

Find a time server for NTP to get the current time (EtherCard library)

There are lots of examples around how to connect with an NTP server, but I do not see how to find such an IP-address. From the examples I conclude I need to find it on for example pool.ntp.org, but I ...
0
votes
0answers
54 views

millis overflow on ATTINY24 - 16bit arithmethic

I'm currently writing a program with Arduino for an ATTINY24 (running on 16Mhz external crystal). Since 32bit arithmetic is expensive compared to 16bit and also take up more program memory I casted ...
1
vote
2answers
111 views

Calculate time between 2 data of a sensor

I'm working on a project in my university and I'm having a trouble in calculate time. I have a conveyor and an IR sensor which I use to calculate the maximum and minimum distances of a box when it is ...
0
votes
2answers
62 views

Why can't I declare variables inside an if statement?

I have a void function that helps me set the time on my arduino clock. I need to use the same function twice - once for the alarm and once for the actual time. The variables I am defining need to ...
0
votes
1answer
99 views

Random output on decoding time from LTC audio using arduino UNO

I am a newbie in Arduino and I am trying to decode time from ltc audio. For this I got Arduino UNO. I got a sample code from here.. Here my code: #define icpPin 8 // ICP input pin on arduino ...
0
votes
1answer
69 views

Printing Time to Serial Port

I am reading sensory data that comes from the digital inputs(two DHT11 Humidity sensors using adafruit library.) and I would like to add a hh:mm:ss real time counts next to them. I try to use the time....
0
votes
2answers
63 views

Can't store time over 9 hours and 10 minutes

I am making a clock on my Arduino Uno using the time library http://playground.arduino.cc/Code/Time I let the user set a time. Which is then converted to seconds and used in the setTime(s); ...
1
vote
1answer
84 views

millis() in a millisecond stopwatch

I'm making a stopwatch that will measure time between two points. I want that stopwatch to have a millisecond accuracy. After the start when someone touch the pad it will show like the time of the ...
0
votes
1answer
37 views

Creating date string for error log

Well, googling didn't do much to help me here and I'm shocked that something I can do in two lines of code in C# DateTime dateTime; string text = dateTime.ToLongDateString(); is this difficult ...
1
vote
3answers
2k views

Resetting millis() and micros()

I want to know how much time has elapsed since a certain event, and I do not want to use any external timers. It seems logical to reset an internal timer whenever the event occurs (using an interrupt)....
1
vote
1answer
45 views

Keyboard input arduino speed

I have an Arduino clone of a Leonardo and I was just wondering how many keyboard commands I can send to the computer per second via USB. I'm not talking about the delay between send and receive (...
0
votes
1answer
49 views

Trying to start a timer to change lights when a button is pressed

I am trying to setup a series of lights (traffic lights) that change based on a timer that begins when a button is pressed. The goal is to use the lights to track how long its been since you pressed ...
3
votes
3answers
446 views

How do I run a loop for a specific amount of time?

I currently have a for loop that loops 300 times and then moves on. Instead, I'd like that loop to run for a specific number of minutes, instead. Here's the current loop, for reference. for(int i = ...
1
vote
2answers
70 views

My RTC is returning a sporadic date/time

RTC seems to be sporadically returning bogus date/times. Here are the logs from my serial monitor: 2016/3/23 8:19:46 2017/3/23 8:19:46 2016/3/23 8:19:46 2016/3/23 8:19:46 2016/3/23 8:19:46 2016/3/23 ...
1
vote
1answer
260 views

Does not name a type error when using makeTime

I am getting a "does not name a type" error when trying to use makeTime() from the Time.h library, code snippet as follows: #include<Time.h> tmElements_t tmet; tmet.Year = 2013-1970; tmet....
1
vote
1answer
65 views

Arduino Timer Button

I am wandering how I would make it so the arduino uno will start a timer when button a is pressed and send "Start" or "Begin" or something like that to the console window. after the timer has started ...
-1
votes
1answer
56 views

Picking the time a led on an arduino should turn on, via android

I have created an app which is connencted to my arduino via bluetoth. The user of the app can turn on and off a led which is connented to the arduino. But I want to take it a step further... I want ...
4
votes
3answers
132 views

Clock drift - is the precision of the crystal the only culprit?

I've a wall clock (sorry, code's a mess, look for updateClockVars) which makes use of the Timezone library (and ultimately Time). Nothing fancy, call millis() every loop; turn to Hrs, Mins, Secs; ...
0
votes
2answers
41 views

Start timer when pins connected

I have switch is a line connected to Digital pins 1,2,3,4,5 . When pins 1 connects, I need a timer to start. as the rest connect i need it to mark the time in the console output of each one and End on ...
3
votes
4answers
458 views

Multiple non-blocking countdown timers?

I'm building a control system for three sump pumps using a single Arduino and a set of relays. I have float sensors for each one, and need the Arduino to trigger the relays when the float sensors are ...
1
vote
1answer
84 views

Convert UNIX Timestamp

I have an UNIX Timestamp in my Arduino Sketch and would like to get the day of the week of this timestamp (1-7). How can I convert the timestamp to get the day of the week?
0
votes
0answers
58 views

Unexpected output pin behavior (was Relay on/off doesn't loop)

So I want to switch a relay on/off with a time interval. But it seems to work only once through the void loop() then it doesn't switch on/off anymore. Any ideas why this is so? const int switchPin =2;...
1
vote
1answer
95 views

Should millis() be stored in a variable once each loop, or called for every reference?

When comparing the value of millis() numerous times per loop(), are there reasons for/against storing it in a variable once at the top of loop(), v.s. calling millis() each time? The most basic ...
1
vote
1answer
78 views

Arduino Uno Wire Transmission Issues

I am developing code to run a word clock and have noticed a slight problem. I am using a DS3231 to keep time, and using the Wire library to communicate with it. I ping the DS3231 every second to get ...
0
votes
1answer
337 views

NTP Client Library. Set sync provider pointing to public class function. Possible?

I am trying to develop a NTP client library for ESP8266/Arduino to make adding NTP sync an easier task. Basically, I've thought about a constructor as NTPClient(String host, int interval); and a ...
0
votes
2answers
66 views

Issue with simple project

I'm new to Arduino and today I have a problem with this code: int led_1 = 10; int led_2 = 11; int led_3 = 12; int button = 3; int time = 0; byte val = 0; void setup() { // put your setup code here,...
1
vote
1answer
491 views

Library to correct time for DST

I am using a Uno as a data logger with a DS1307 RTC and the following libraries Time.h DS1307RTC.h The DS1307 does not have any support for DST and neither library includes Time Zone. Are there any ...
5
votes
1answer
1k views

The difference between “time_t” and “DateTime”

I've run into an issue trying to combine 2 different Arduino timer projects I've found online. For both projects I'm using a DS3231 RTC, but have been able use the DS1307 library just fine in my ...
1
vote
0answers
139 views

Occasional incorrect time returned by NTP

I have an Uno with CC3000 wifi shield and am trying to use the sntp.h library to get NTP time. I have been experimenting with a modified version of the ntpTest code from the library which fetches the ...
0
votes
1answer
2k views

Arduino Mega, Ubuntu, Time.h: No such file or directory

I'm using an Arduino Mega with Ubuntu 15.10. Sadly I've got an error during compilation, that the Time.h library cannot be found. The verbose compile output shows: /usr/share/arduino/hardware/tools/...
4
votes
0answers
124 views

RTC resets when power is off

I have a few RTC modules with a batteries. All of them have this same issue with my project. They work fine when connected via USB. But if I disconnect the power then reconnect they reset to Jan 1 ...
0
votes
2answers
182 views

Arduino Ethernet Shield Response Process, Time, and Synchronization

I have a ethenet shield. I want to update my server page. Server page have to show current time. The code is given in this link. Code works but there is two problem 1- When i press the stop button in ...
1
vote
1answer
165 views

How can I build a simple “Smartwatch” with Arduino Pro Mini and Display?

I want to know how I can build a simple "Smartwatch" with an Arduino Pro Mini and a Display with a size from maybe 1,5" what Display should I use for Touch and color? I only want simple things like ...
0
votes
1answer
72 views

Issue with time-dependant conditional I/O control flow (Arduino UNO)

We are working on a project to control the reaction of a system to a lever, whose position is monitored by two IR sensors at the ends of its travel, the Reward sensor and the Trigger sensor. There ...
0
votes
2answers
280 views

DS1302 as a counter/count-up timer

I would like to use the DS1302, as a count up timer. My goal is to have the arduino time the amount of me driving my car. So it DS1302 will be used a count-up timer ie accumulate time. however when ...
17
votes
3answers
9k views

How can I handle the millis() rollover?

I need to read a sensor every five minutes, but since my sketch also has other tasks to do, I cannot just delay() between the readings. There is the Blink without delay tutorial suggesting I code ...