Pages: [1]   Go Down
Author Topic: How to use millis() or micro() function in Arduino Due  (Read 1229 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to measure the execution time of my code using micros() function. I have previously used it in Arduino 2560. But when I am using it in Due, it is showing error. I assigned the time variable as -
Unsigned long time

and it is showing as
 'long unsigned int time' redeclared as different kind of symbol


Please help me out.
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 63
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

maybe you need to typecast it?

unsigned long time

time = (unsigned long) millis();
Logged

Remember remember, the 4th of...July!  Duh.

Leighton Buzzard, UK
Offline Offline
Edison Member
*
Karma: 21
Posts: 1339
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

can you show your
Code:
code
Logged

there are only 10 types of people
them that understands binary
and them that doesn't

Offline Offline
Edison Member
*
Karma: 33
Posts: 1478
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Unsigned != unsigned.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry that was a typo here. I used unsigned long time ...  smiley-razz
Logged

0
Offline Offline
God Member
*****
Karma: 26
Posts: 626
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Perhaps newlib is defining the time() function, since it tries to follow POSIX.
Logged

Pages: [1]   Go Up
Jump to: