Skip to main content

Questions tagged [time]

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.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
26 views

Use DS3231 with battery and vcc at the same time

I have ds3231 which i want to use to keep track of time even when the in my ase esp32 is without electricity. I however read some difference stuff regarding using the vcc and battery on he same time. ...
acroscene's user avatar
1 vote
1 answer
97 views

Fixing a pedestrian traffic light sequence pattern in a cycle using millis and without delay

I was emulating the pedestrian traffic light cyclic pattern (red, green, green flashing) in the next Arduino code. But when I run this code with my ESP8266 Wemos D1 mini controller, it appears the ...
Hong Christian Lin Jiang's user avatar
0 votes
1 answer
106 views

Unable to get keypad key in while loop [closed]

I'm a beginner into Arduino so I have a little problem where I'm trying to do a countdown on LCD using while loop but I'm also trying to get a key input inside that same while loop. Problem is that ...
DevChips's user avatar
0 votes
2 answers
57 views

Serial Buffer stays empty as soon as it becomes empty once

I have a question regarding serial buffer readout. At program start, I send a serial command to a sensor that 1. activates him and 2. let him send data - that works. When I unplug the sensor, the ...
Gymknopf's user avatar
0 votes
1 answer
825 views

(Why is) getLocalTime() on ESP32 taking several seconds to complete successfully

This is a cross-post from https://github.com/espressif/arduino-esp32/discussions/8653 as it didn't yield any results there. I noticed that getLocalTime() is consistently taking 5-10+ seconds to ...
Marcel Stör's user avatar
2 votes
1 answer
77 views

Functions delaying gesture sensor recognition

I am working on a simple little robot to cure my boredom and all it has is a 64 x 32 OLED for the eyes, and a PAJ7620 Gesture recognition sensor with a Seeeduino Xiao as the main board. Basically, ...
Renier Jr.'s user avatar
-1 votes
1 answer
235 views

localtime - executing one after the other- different time_t, but getting same results

When I try to comapre 2 time_t values I get unexplained behavour time_t t = 12345; time_t T = 67890; struct tm *tm = localtime(&t); struct tm *Tm = localtime(&T); char timeStamp[40]; ...
guyd's user avatar
  • 1,049
2 votes
0 answers
103 views

I goofed: I used a digital output rather than an analog output

OK, I have a little hardware issue I need to fix in software for the time being. I say, "For the time being," because I already have the PC Boards printed, and I need to make do for this ...
Leslie Rhorer's user avatar
0 votes
1 answer
801 views

Arduino Nano 33 BLE getting the current time using RTC

I have a an arduino NANO 33 BLE and I'm trying to get the current time and date. Based on the documentation, the arduino has nRF52840 microcontroller which comes with a 24 RTC timer It is listed in ...
Riperoni's user avatar
1 vote
4 answers
2k views

What is the ideal way to check if time on ESP8266 via NTP is ready?

With ESP8266, I noticed that for the first 1 or 2 loops, localtime returns Unix epoch (1970 date) until it has finished getting the actual time from NTP, after which point I see the real date. ...
Nick Bolton's user avatar
2 votes
1 answer
782 views

Attiny timer interrupt does not make an interrupt every 1000ms

I'm making a stopwatch using an attiny85, the idea was to use the timer interrupts to count the seconds my theory was: since I set the Attiny85 to run at 1Mhz, I can use a presale of 1024; 1000000 / ...
Isael Guillén's user avatar
3 votes
0 answers
1k views

How to correctly synchronize time with NTP server?

I want to synchronize time with NTP server once in some time. I am using DOIT ESP32 DEVKIT V1, I tried with getLocalTime() function but it returned true even without wifi, but as I know without wifi ...
hungryman's user avatar
1 vote
4 answers
866 views

How to efficiently code a long duration timer

I'm working on a battery-powered project. I'm trying to write code, which checks the battery voltage every 30 minutes and changes the color of a LED accordingly. Should I still be using millis() or is ...
Zhelyazko Grudov's user avatar
0 votes
1 answer
3k views

`time.h` vs `TimeLib.h` on AVR boards

Why do I get wrong result when using time.h library when using AVR boards, such Nano/Uno/Pro Micro (while when using TimeLib.h). OUTPUT (for given Epoch ): TimeLib: 2022-04-02 16:11:20 time.h: 0152-03-...
guyd's user avatar
  • 1,049
2 votes
2 answers
83 views

Trying to keep my main code running unless an input is LOW for a certain amount of time

I have code that creates a sequential signal with 4 LEDS. It cascades to the right. This works when I hold down the input button. What I need help with is having the code run exactly the same when ...
Myles's user avatar
  • 73
0 votes
1 answer
3k views

Set time() on ESP8266

If I call configTime() on a ESP8266 using ESP8266 Core, then time() gets changed from uptime to unixtime. However this sends a SNTP request. I have a DS3231 RTC attached without internet. How can I ...
rnsi's user avatar
  • 11
0 votes
1 answer
607 views

sizeof tm struct (datetime) different on ESP32 vs linux64x

I am logging binary data to my SD. I log a datetime object of type 'tm', which is 36 bytes on ESP32. When I create a datetime of type 'tm' on linux it is 56 bytes. ESP32 write tm to SD: [tm datetime = ...
washichi's user avatar
-1 votes
1 answer
2k views

`ConfigTime` daylight saving update

I'm using an ESP8266 to get clock NTP sync in this manner: void myIOT2::_startNTP(const int gmtOffset_sec, const int daylightOffset_sec, const char *ntpServer) { configTime(gmtOffset_sec, ...
guyd's user avatar
  • 1,049
1 vote
1 answer
6k views

ESP8266: error: 'getLocalTime' was not declared in this scope

I am getting error: 'getLocalTime' was not declared in this scope when I am compiling this code for ESP8266, however works for ESP32: #include "time.h" void gettime() { static int16_t ...
Murad's user avatar
  • 11
1 vote
2 answers
402 views

run a function for a certain amount of time! [duplicate]

i'm working on a project where i need to run a function for 20 minutes and the function writes to memory using EEPROM every minute. How can i make the function run for 20 minutes, i was thinking of ...
rohithrathod banoth's user avatar
1 vote
0 answers
167 views

Inconsistent values from NTP client

Hardware- ESP8266 Based NodeMCU I am using NTP Client for time in my alarm project. I am facing an issue where NTP client is not returning proper values, in the sense that it works properly for the ...
Coder9390's user avatar
  • 472
1 vote
1 answer
2k views

ESP8266 ISO 8601 string to tm struct

I have a web service that returns timestamps in ISO 8601 format, e.g., "2021-06-25T12:00:00" I'm trying to turn the timestamp string into a tm type struct from the ESP8266 library <time.h&...
Boyfinn's user avatar
  • 223
1 vote
1 answer
164 views

Get production count for current minute

I am trying to make a production counter for a machine. I want to display production count of the last minute for each seconds. So, display should update every second and should display real value of ...
user_fs10's user avatar
  • 187
1 vote
0 answers
60 views

Hello, help with CODE servo mechanism and DS1307

I am trying to make a auto feeder for birds!, I can't setup my code, the aim is to move servo when the certain time comes, My commend if doesnt work, what else commend can I use? #include <Wire.h&...
matitanix's user avatar
0 votes
2 answers
70 views

Switching time of a multiple input switch

I basically have two switches Both switches will be pressed simultaneously in different order I want to know which switch was pressed first
Obed's user avatar
  • 9
1 vote
2 answers
655 views

unable to modify NTPClient to use static IP address

I tried the example File > Examples > ESP8266WiFi > NTPClient which requests the current time and it worked fine. Then I tried to modify it so that the ESP8266 would have a static IP ...
user avatar
2 votes
2 answers
4k views

Measure the time between 2 inputs

I am making a small project, and for that, I need to measure the time between 2 inputs. basically, a program to measure the time elapsed from when digital pin 2 is high to when it again becomes high.
Chinar's user avatar
  • 21
6 votes
5 answers
3k views

Is there any better choice other than using delay() for a 6-hours delay?

I am designing an incubator system and I need to drive a motor forward and reverse every 6 hours. Is there any better choice other than using delay()? A 6-hours delay seems a little unprofessional.
henzup's user avatar
  • 63
2 votes
1 answer
243 views

Help with millis to get accurate timing

I'm essentially trying to create a music box which is light activated using an LDR. When it's open a song plays, while a servo rotates a figurine back and forth, and an LED dims and illuminates in ...
TonyStark's user avatar
1 vote
0 answers
169 views

Can I record us (microseconds) with AnalogBinLogger example in SdFat's library?

I am using the AnalogBinLogger from the SdFat example library. I am using it to record 8 analog channels at 5kHz! which is amazing (thank you SdFat). Is it possible to include a separate column to ...
Microk's user avatar
  • 115
2 votes
0 answers
55 views

Two LED Patterns Task Controlled by GUI

I am very new to Arduino and coding/programing. I set a task for myself to make a simple circuit of 5 LEDs controlled by pins 2, 4, 8, 11, 12. I want to be able to make two different pattern for the ...
Tayler Hasson's user avatar
0 votes
2 answers
1k views

ESP32 feedback from NTP

The basic example for ESP32 NTP is very rough: void setup() { Serial.begin(115200); //connect to WiFi Serial.printf("Connecting to %s ", ssid); WiFi.begin(ssid, password); while ...
Mark's user avatar
  • 393
-2 votes
1 answer
1k views

Sync of Time Library and RTClib

Trying to understand the two libraries and setSyncProvider(RTC.now). Using Arduino Uno with Adafruit ChronoDot. Aduino IDE 1.8.13. The code below is simply to understand what is happening. I am ...
RickH's user avatar
  • 41
1 vote
2 answers
7k views

Arduino Time Library and RTC Libraries

I am using RTClib.h and TimeLib.h with an Uno. Have been struggling for days in understanding the various RTC libraries available and how to use them with the Arduino Time Library. Question 1. If I do ...
RickH's user avatar
  • 41
2 votes
1 answer
521 views

what happens on Arduino power-on, and how long does it all take?

Here's what I think happens and how long it takes (FIXME means I don't know). I'd like to end up with solid max times for everything if possible. Power-on, input caps to the 328P begin charging and ...
Britton Kerin's user avatar
1 vote
0 answers
69 views

RTC and Time Library Problems

Want to use Arduino Time library and occasionally sync it with an external RTC (Maxim DS3231 chip). I am turning LEDs on and off based on time and using a shift register (Nexperia 74HC154PW) and ...
RickH's user avatar
  • 41
0 votes
1 answer
2k views

Running a DC motor for a set amount of time

I am trying to run a DC motor for 100ms and then turn it off completely. Here is my code any suggestions on why it might not be working? My Code const int pirPin = 9; const int motorPin = 2; int ...
Erin Rehm's user avatar
2 votes
3 answers
2k views

How to create a 1-hour timer with an ATtiny13A microcontroller?

I want to control an AC load such that it powers on for 1 minute, then turns off for 1 hour, then on again for 1 min, and so on, in a loop. I just modified the blink sketch to do: Turn A1 on Then ...
VOID seekers's user avatar
1 vote
0 answers
332 views

Run a dc motor for amount of time without delay

Hi everyone I have a project and I need to run a dc motor for amount of time without using delay I use DelayWithoutBlink technique. In this code the motor should run for 5 second in cw then it will ...
yo777's user avatar
  • 23
2 votes
1 answer
3k views

How to Set RTC in ES32 using NTP server?

I am working on ESP32 And want to set RTC from the NTP server. How can I get epoch value I have done this thing on CC3200 launchpad and used an NTP server library to obtain epoch value.
Abdul Wasey's user avatar
0 votes
1 answer
806 views

Fail to convert time_T from past to tm struct

Continuing a Question asked few days ago, answered by Edgar, a new question has rised: My goal was using a past time_t value, and convert it into a struct tm variable in order to use it, part as a ...
guyd's user avatar
  • 1,049
1 vote
2 answers
3k views

How to keep track of millis during sleep mode

In my application, I need to keep track of the time the application has been running as well as use sleep modes. However, when using the sleep modes, Timer0 is disabled, and therefore millis stop ...
Glyn Davidson's user avatar
0 votes
1 answer
1k views

Error passing a `time_t` and `struct tm`, ESP32

I need to create a converter from epoch time stored in a time_t variable, to a struct tm variable, in order to check / create a certain task every hour or a day. This function should get also a past ...
guyd's user avatar
  • 1,049
1 vote
1 answer
1k views

Bluetooth: sync time from an NTP server via Internet connection shared with Android phone

I saw that it is possible to sync time from an NTP server over WiFi. I have the HC-06 Bluetooth module and an Android phone that can share its Internet connection with Arduino via Bluetooth. Would it ...
user1876484's user avatar
0 votes
1 answer
1k views

Parola library and DS3231 clock

EDIT2: Well, this is the "new" code and it just displays random dots on the matrices: #include "RTClib.h" #include <MD_Parola.h> #include <MD_MAX72xx.h> #include <SPI.h> // Define ...
Rehoboam's user avatar
1 vote
1 answer
920 views

UNIX time in ms to human date time

Been struggling with something for a few days. Loading data from a website via JSON and it includes an updated date time in milliseconds. This is an EPOCH date and I can get the right value using ...
Lifesigns's user avatar
1 vote
0 answers
59 views

How to pause the analog value according to input signal applied to a particular digital pin?

I'm working with a digital blood pressure meter using arduino nano. I need to display the pressure reading during inflation and deflation of the cuff instantly. And when an input signal applied to a ...
Mstar3's user avatar
  • 11
0 votes
1 answer
301 views

How to subtract micros()?

I am attempting to calculate the time between pulses by comparing the micros() timestamp. I understand that you cannot just simply subtract unsigned longs, but I cannot understand what the alternative ...
Andi Stancu's user avatar
0 votes
1 answer
125 views

How to set a timer for a function and be able to reset it in the middle of the process?

Hello me and my friend have to do an assignment for school but we need some help. We have to make a LED turn on and of with a button and a relay. But when I press the button the LED should be on for ...
daan 's user avatar
  • 13
1 vote
0 answers
39 views

I need to happen a process between 2 given times in Arduino

In my project i have a function which i only need to execute if the current time is between given 2 times. Note that the time is fetched from RTC so its 24hr. For example if current time is 23:00,...
Shyam Sangeeth's user avatar

1
2 3 4 5