Hi
I am using platformIO with eclipse IDE, on compiling my setpcount project i got following error
src/sourceblock.cpp:67:30: error: ‘eventCallback’ was not declared in this scope
CurieIMU.attachInterrupt(eventCallback);
src/sourceblock.cpp:68:14: error: ‘class CurieIMUClass’ has no member named ‘interrupts’
CurieIMU.interrupts(CURIE_IMU_STEP); // turn on step detection
#include “Arduino.h”
#include “CurieIMU.h”
const int ledPin = 13;
void updateStepCount();
boolean stepEventsEnabeled = true; // whether you’re polling or using events
long lastStepCount = 0; // step count on previous polling check
boolean blinkState = false; // state of the LED
CurieIMUClass CurieIMU;
void setup() {
Serial.begin(9600); // initialize Serial communication
while(!Serial) ; // wait for serial port to connect.
// pinMode(13, OUTPUT);
// intialize the sensor:
CurieIMU.begin();
// turn on step detection mode:
CurieIMU.setStepDetectionMode(CURIE_IMU_STEP_MODE_NORMAL);
// enable step counting:
CurieIMU.setStepCountEnabled(true);
if (stepEventsEnabeled) {
// attach the eventCallback function as the
// step event handler:
CurieIMU.attachInterrupt(eventCallback);
CurieIMU.interrupts(CURIE_IMU_STEP); // turn on step detection
Serial.println("IMU initialization complete, waiting for events...");
}
}
void loop() {
/* Instead of using step detection event notifications,
we can check the step count periodically */
if (!stepEventsEnabeled) {
updateStepCount();
}
digitalWrite(13, blinkState);
blinkState = !blinkState;
delay(1000);
}
void updateStepCount() {
// get the step count:
int stepCount = CurieIMU.getStepCount();
// if the step count has changed, print it:
if (stepCount != lastStepCount) {
Serial.print("Step count: ");
Serial.println(stepCount);
// save the current count for comparison next check:
lastStepCount = stepCount;
}
}
void eventCallback(void) {
if (CurieIMU.stepsDetected())
updateStepCount();
}
CurieIMUClass has member interrupt, how to resolve it?, i have updated platform.