Hi all
I am trying to use two external interrupts with my uno and got this error message:
invalid conversion from 'long unsigned int (*)()' to "int' with my first SRI.
After attempting this and that with the help of Google I still do not grasp what's wrong.
Could it be the way I am setting up my interrupts?
/* Attempting to use external interrupts on pins 2,3 on uno
to rcord the micro seconds when the pin changes state.*/
#include <LiquidCrystal.h>;
LiquidCrystal lcd(12,11,5,4,3,2);
// create memmory space for values//
int first = 2;
int second = 3;
volatile int time = 0;
volatile int time2 = 0;
float ms,fs,elap;
//declare input pins, atach interrups and start lced and serial
//monitor
void setup(){
pinMode (first,INPUT);
pinMode (second,INPUT);
attachInterrupt(0,Grab,CHANGE);
attachInterrupt(1,Grab2,CHANGE);
Serial.begin (9600);
lcd.begin(16,2);
Serial.print("Wainting on shot...");
lcd.print("Awaiting shot");
}
// SRI for interup on pin 2.... and where the error leis
void Grab(){
time = micros;
detachInterrupt(digitalPinToInterrupt(2));
}
void Grab2(){
time2=micros;
detachInterrupt(digitalPinToInterrupt(2));
}
void loop(){
elap = time2-time;
m/s = 250000/elap;
f/s = 820210/elap;
if (m/s>1){
Serial.print (m/s);
Serial.println (" M/s");
Serial.print (f/s);
Serial.print (" F/s)");
lcd.clear();
lcd.setCursor (0,0);
lcd.print (m/s);
lcd.println(" M/s");
lcd.print (f/s);
lcd.print (" F/s");
}
Second issue: I set time and time2 =0, then later I inadvertingly us 0 as devider.
I thought I would just get an -1 from that (according to google)
BUT then found this You tube video:
www.youtube.com/watch?feature=player_detailpage&v=mZ7pUADoo58
Feeling silly: Apparently the video were just a joke. Must have been to many Hacker movies. LOL