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
vote
1answer
30 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 ...
1
vote
0answers
11 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&...
1
vote
0answers
25 views

How to move 3 steppers at the same time?

I am working on a Makeblock project in which I have 3 steppers. I am trying my own code and I want to move the 3 steppers at the same time (not exactly at the same time, but visually). I have my ...
-1
votes
1answer
41 views

How can we find the time from a digital clock and do a read?

I have a digital clock I bought online. It displays time and calendar and has buttons to change the lights. I need to connect the clock to an Arduino and read the time from it. How can we achieve this?...
0
votes
1answer
60 views

Calculate Timezone from GPS Coordinates

I have a uBlox NEO-6M GPS module and it is outputting longitude and latitude. It is also outputting time which is UTC. I want to use the GPS coordinates to calculate the timezone and then subtract and ...
0
votes
2answers
33 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
0
votes
0answers
65 views

drifting serial readings

I have a python script that continuously reads the serial port for digital thermometer reading. After a period of time, the serial reading will drift by 10+ degrees in some cases. I let it run, I ...
1
vote
1answer
39 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 ...
1
vote
2answers
83 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.
6
votes
5answers
2k views

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

I am designing this 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.
3
votes
0answers
69 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 ...
0
votes
0answers
50 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 ...
2
votes
0answers
43 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 ...
0
votes
2answers
82 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 ...
-2
votes
1answer
105 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 ...
1
vote
2answers
715 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 ...
2
votes
1answer
56 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 ...
1
vote
0answers
37 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 ...
0
votes
1answer
117 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 ...
2
votes
2answers
444 views

How to create a 1 hour timer with ATtiny13A microcontroller?

I want to control an AC load such that it powered on for 1 minute, then 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 delay ...
0
votes
0answers
110 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 ...
0
votes
1answer
605 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.
0
votes
1answer
179 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 ...
0
votes
2answers
468 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 ...
0
votes
1answer
146 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 ...
1
vote
1answer
245 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 ...
0
votes
1answer
316 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 ...
1
vote
1answer
97 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 ...
1
vote
0answers
54 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 ...
0
votes
1answer
69 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 ...
0
votes
1answer
46 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 ...
1
vote
0answers
27 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,...
0
votes
0answers
45 views

Arduino acting strange with photoresistor data

So I stumbled into strange problem. I have this circuit, where I connect 2 photoresistors and bluetooth HC05 to Arduino. When one of the resistors senses bright light bluetooth sends '1' or '3' ...
0
votes
1answer
193 views

How to set a time out like Serial.setTimeout() for Serial.read()?

I read a comment form here: "Serial.setTimeout() sets the maximum milliseconds to wait for serial data when using Serial.readBytesUntil(), Serial.readBytes(), Serial.parseInt() or Serial.parseFloat()...
0
votes
1answer
1k views

Set the wall clock time or change GMT offset without ntp server?

I have been able to get the current time from an NTP server and set what appears to be an internal clock using the configTime() function from the ESP32 core. I can then get the current time with the ...
0
votes
1answer
3k views

ESP32 documentaiont for “time.h”

I am working from the example sketch in that installed with the ESP32 Dev Module into the Arduino IDE. It includes <WiFi.h> and "time.h". I have a number of questions about how to use the ...
-1
votes
1answer
34 views

execute if function in a timed loop

I have a school project where I had to make a piece of code work for 1 minute and then return. I first used a RFID reader which didn't work for me so I decided to use the serial monitor. I did this ...
1
vote
1answer
2k views

ESP32 seconds from epoch

When using ESP8266 - getting seconds from epoch is done using NTP.begin(NTPserver, 2, true); delay(delay_tries); time_t t = now(); while t stores amount of seconds from 1-1-1970. When trying to do ...
0
votes
1answer
35 views

Missing time when using timer

I have set up Timer2 to count every tick at 16MHz, or 62.5ns per tick. Then I run the following code: int t = 0; for (int i=0;i<64;i++){ data[4*i] = TCNT2; data[4*i+1] = TCNT2; byte now =...
0
votes
1answer
94 views

When does the ADC take the reading?

I'm experimenting with the "2 pin capacitance meter" and trying to make it more accurate. Currently I've made the Arduino read 62.5 ns intervals but this means the time for the ADC to read is taking ...
0
votes
1answer
38 views

How to execute commands over desired amount of time

I have a program that receives 4 commands on 4 channels to change the color of an LED using mqtt communication. Lets just focus on two of the channels, the time and the red. I am sending a length of ...
1
vote
2answers
2k views

Converting human readable date to a unix timestamp [duplicate]

Can anyone provide a sample code that would convert a human readable date like 2019-10-27 22:10:35 to a unix timestamp like 1572214235? I found many topics about it, but they eider refer to out of ...
0
votes
0answers
38 views

Send information from computer to Arduino via USB (basic clock)

I've created a small project using an Uno. I usually mess around with ESP8266 chips, because they have WiFi and are relatively easy to work with. However, this time I've decided to go right back to ...
-1
votes
1answer
69 views

how to convert date to timestamp? [duplicate]

How should I convert date format(dd-mm-yyyy) to timestamp value . Can anyone suggest code how to convert and where to put code .
0
votes
1answer
146 views

Time information from GPS receiver: how to tell whether it is fresh or stale?

I see that TinyGPS++ library extracts time information from GxRMC and GxGGA NMEA sentences streamed by GPS receiver. However, in my experiments I observed that both of my GPS receivers generate GxRMC ...
0
votes
4answers
114 views

When GPS can't see satellites, how can I continue to tick off a smooth-ish time?

I'm getting 10 updates/sec from my GPS unit (The MTK3339 used in the Adafruit breakout board), and using it to update a clock display. This works well enough, though there's one minor problem that I'd ...
-1
votes
1answer
56 views

Using a Force Sensing Resistor and time input

So the code below measures how much force is exerted on the FSR. I would like to know what would I have to change in this code so that it can record for how long the FSR is being pressed for. So ...
0
votes
1answer
159 views

Arduino is running as a server, but want to occasionally act as a client to update time

My Arduino (actually an ESP32-based Adafruit HUZZAH32) is running as a wifi server. Its main job is to service GET requests from a user, and to periodically turn devices on and off based on the ...
0
votes
1answer
71 views

Why does a function inside void set up is repeating after some minutes

I am trying to time sync my arduino hardware to NTP server. I have a `setSyncProvider(getNtpTime)´ function to do it and called inside the void setup. I have another function (mainFunction) inside the ...
1
vote
1answer
73 views

RDTSC alternative for Arduino

To calculate an operation execution time, I was saving the millis() result before and after the operation to calculate the interval time. Is there an alternative on the Arduino Uno like the RDTSC ...