I’m having Problems to convert the following code from an Arduino Uno (ATmega168/328) into a running Version on the Arduino Mega 2560 (ATmega2560). Problem is that Timer1 is not wird to Pin5 at Arduino Mega 2560.
#define SET(x,y) (x |=(1<<y)) //-Bit set/clear macros
#define CLR(x,y) (x &= (~(1<<y))) // |
#define CHK(x,y) (x & (1<<y)) // |
#define TOG(x,y) (x^=(1<<y)) //-+
unsigned long t0=0; //-Last time
int t=0; //-time between ints
unsigned char tflag=0; //-Measurement ready flag
float SENSITIVITY= 1000.0; //-Guess what
//-Generate interrupt every 1000 oscillations of the search coil
pinMode(13,OUTPUT); //-piezo pin
digitalWrite(12,HIGH); //-NULL SW. pull up
//-Set up counter1 to count at pin 5
I found several Information that T5 (Pin47) can be used the same wise but I’m not able to get it run.
Does anyone of you know how to handel the code that T5 (Pin47) on Arduino Mega is controlled the same wise as T1 (Pin5) on Arduino Uno. Project ist the metal detector found here…