Success, finally.
I reinstalled IDE 1.0.5 and used only the old library files on Windows Vista.
I picked out the Interrupt coding from the weather station sketch and tried it on a Uno. Interrupts worked. I tried it with a Mega – Interrupts did not work.
On the Internet I found examples using "attachInterrupt". I modified a simple example code. This would not verify on IDE 1.0.5. I moved to a Windows 7 machine running IDE 1.6.5 and the code verified and worked with both Uno and Mega. There was 1 Megohm pulldown and a pushbutton to 5V for digital pin 3.
Code: Select all
//#include <PinChangeInt.h>
#define PIN 3 // the pin for button/ rain gauge
volatile int flag=0;
int nflag;
void setup()
{
Serial.begin(9600);
pinMode(PIN3, INPUT); //set the pin to input
digitalWrite(PIN3, LOW); //use the internal pullup resistor
attachInterrupt(digitalPinToInterrupt(3), burpcount, RISING);
// PCintPort::attachInterrupt(PIN3, burpcount,RISING); // attach a PinChange Interrupt to our pin on the rising edge
// (RISING, FALLING and CHANGE all work with this library)
// and execute the function burpcount when that pin changes
Serial.println("---------------------------------------");
}
void loop()
{
delay(3000);
Serial.print(flag);
}
void burpcount()
{
flag++; }
I switched back to the Dell running Vista and loaded IDE 1.5.6-r2 and the example did verify and run with both Uno and Mega.
Then I changed the weather station code to use attachInterrupts and tried to run it on the Mega. It did work after I had installed the later SD_Master. Here are the relevant lines.
Code: Select all
pinMode(PIN, INPUT); //set the pin to input
digitalWrite(PIN, LOW);
attachInterrupt(digitalPinToInterrupt(3), burpcount, RISING);
// PCintPort::attachInterrupt(PIN, burpcount,RISING); // attach a PinChange Interrupt to our pin on the rising edge
// (RISING, FALLING and CHANGE all work with this library)
// and execute the function burpcount when that pin changes
I believe that the attachInterrupt function is internal in IDE code later than 007 – how that translates to the 1.*.* IDEs I do not know, but 1.5.6-r2 is OK. It seems that PinChangeInt does not work with Megas.
Seems to me that Arduino is no longer easy for amateurs, thanks to lack of backward compatibility issues.
And, No, I did not succeed in getting two IDE’s running in Vista, by my ignorance and lack of detailed advice.