millis() not working on DUE


hello everyone,

i have 2 boards:   1. arduino uno r3 and  2. arduino due r3-e.
i using arduino 1.5.7 on windows 8.1  64 bit
my problem piece of code works fine on uno not on due.

code: [select]
/*program execution time*/

unsigned long time;
unsigned long number = 1234567ul;

void setup()
{
  serial.begin(9600); 
  for(unsigned long counter = 1ul; counter != number + 1; counter++)
  {
    if(number % counter == 0)
    {
      serial.println(counter); //print factors
    }
  }
  time = millis();
  serial.print("time: ");
  serial.println(time / 1000); //print time in seconds
}

void loop()
{

}


on uno output on serial monitor:
code: [select]
1
127
9721
1234567
time: 47


but on due same code generates compile time error:

arduino: 1.5.7 (windows 8), board: "arduino due (programming port)"

build options changed, rebuilding all

progexecutiontiming.ino:3:15: error: 'long unsigned int time' redeclared different kind of symbol
in file included c:\program files (x86)\arduino\hardware\tools\gcc-arm-none-eabi-4.8.3-2014q1\arm-none-eabi\include\stdlib.h:11:0,
                 from c:\program files (x86)\arduino\hardware\arduino\sam\cores\arduino/arduino.h:24,
                 from progexecutiontiming.ino:3:
c:\program files (x86)\arduino\hardware\tools\gcc-arm-none-eabi-4.8.3-2014q1\arm-none-eabi\include\time.h:47:11: error: previous declaration of 'time_t time(time_t*)'
time_t    _exfun(time,     (time_t *_timer));
           ^
progexecutiontiming.ino: in function 'void setup()':
progexecutiontiming.ino:16:8: error: assignment of function 'time_t time(time_t*)'
progexecutiontiming.ino:16:8: error: cannot convert 'uint32_t {aka long unsigned int}' 'time_t(time_t*) {aka long int(long int*)}' in assignment
progexecutiontiming.ino:18:25: error: invalid operands of types 'time_t(time_t*) {aka long int(long int*)}' , 'int' binary 'operator/'

appreciated. thanks.

this nothing millis() examination of error
message show.  symbol "time" predeclared on due,
you need give different name such "my_time".


Arduino Forum > Products > Arduino Due (Moderator: fabioc84) > millis() not working on DUE


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support