login

Author Topic: Using MsTimer2 Arduino-Library  (Read 5627 times)

0 Members and 1 Guest are viewing this topic.

olivere

Using MsTimer2 Arduino-Library
« on: January 17, 2012, 03:13:46 PM »
hello,

i tied to use the Arduino library "MsTimer2" on a Wiring S, but i was not able to compile the example code.

Code: [Select]
#include <MsTimer2.h>

// Switch on LED on pin 13 each second


void flash() {
  static boolean output = HIGH;
 
  digitalWrite(13, output);
  output = !output;
}

void setup() {
  pinMode(13, OUTPUT);

  MsTimer2::set(500, flash); // 500ms period
  MsTimer2::start();
}

void loop() {
}

the error is:


core.a(WHardwareTimer.cpp.o): In function `__vector_11':
/Applications/Wiring.app/Contents/Resources/Java/cores/AVR8Bit/WHardwareTimer.cpp:114: multiple definition of `__vector_11'
MsTimer2/MsTimer2.cpp.o:/Applications/Wiring.app/Contents/Resources/Java/libraries/MsTimer2/MsTimer2.cpp:147: first defined here


What can i do, to get it working? is Timer2 reserved for something ?

Thank you
« Last Edit: January 17, 2012, 03:17:51 PM by olivere »

olivere

Re: Using MsTimer2 Arduino-Library
« Reply #1 on: January 23, 2012, 08:20:16 AM »
I've got it working:

i've just uncommented the function at:

/Applications/Wiring.app/Contents/Resources/Java/cores/AVR8Bit/WHardwareTimer.cpp:114

and it works fine ^^

barragan

Re: Using MsTimer2 Arduino-Library
« Reply #2 on: January 26, 2012, 04:15:05 PM »
great, please also check the libraries tutorial posted by Alexander: http://wiki.wiring.co/wiki/Create_Libraries