Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Arduino Functions Learning

Status
Not open for further replies.
millis()

Description

Returns the number of milliseconds since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 50 days.

Parameters

None

Returns

Number of milliseconds since the program started (unsigned long)

Example


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
unsigned long time;
 
void setup(){
  Serial.begin(9600);
}
void loop(){
  Serial.print("Time: ");
  time = millis();
  //prints time since program started
  Serial.println(time);
  // wait a second so as not to send massive amounts of data
  delay(1000);
}




Take a look in this link :- https://arduino.cc/en/reference/millis
 
Last edited by a moderator:
What is the purpose of this function?

AS described in the last post this functions reruns you the value of time in the form of milliseconds since your Arduino start (your program) or start of your board and after approximately 50 days it will reset this time value to zero.
 

Please let me know that I am using button and adc, button for scrolling and adc with current sensor for measure current,

but problem is that in my button debounce function it uses millis() function and as well as current sensor function

also uses millis() function for delay in sampling of adc values.

When I run program it runs but button debounce are sometime disturbs and changed,

What can I do for proper button debounce as well adc values sampling?

I think that both function uses millis() that`s why is mixing.
 

problem is that in my button debounce function it uses millis() function and as well as current sensor function

also uses millis() function for delay in sampling of adc values.

you need to use delay(x);function where x is the number your delay time in mile seconds.As already answered in post#2.I think you are confused with the function name millis();
delay(1000);// wait a second so as not to send massive amounts of data
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top