If you are asking a question, please follow this template:
- My goal is: achieve interrupt deetction using arduino compat library
- My actions are: I wrote code in c as declared functions in arduino.h library
- The result I see is: implicit function declaration error
- My expectation & question is:
#include "mgos.h"
#include "Arduino.h"
uint8_t pin=25;
uint16_t milliseconds=0;
void handleInterrupt(){
++milliseconds;
if (milliseconds == 999)
{ // roll over to zero
milliseconds = 0;
}
}
void interrupts() {
attachInterrupt(digitalPinToInterrupt(pin), handleInterrupt, FALLING);
}
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(2, OUTPUT);
pinMode(pin, INPUT_PULLUP);
// mgos_ints_enable();
//pinMode(interruptPin, INPUT_PULLUP);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(2, HIGH);
delay(1000); // wait for a second
digitalWrite(2, LOW); // turn the LED off by making the voltage LOW
delay(1000);
println(milliseconds);
}