Skip to content

Instantly share code, notes, and snippets.

@paultnylund
Last active August 10, 2016 03:10
Show Gist options
  • Save paultnylund/b0a60dfae7f13dd0aa11f701d9d7d46d to your computer and use it in GitHub Desktop.
Save paultnylund/b0a60dfae7f13dd0aa11f701d9d7d46d to your computer and use it in GitHub Desktop.
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
#include <Functions_SPROID.h>
void setup() {
init();
}
void loop() {
if( !isIncreasing(rotationAboutY()) ) {
if( isIncreasing(myoAnalogRead()) ) {
digitalWrite(LED_PIN, HIGH);
digitalWrite(VIB_PIN, HIGH);
} else if( isDecreasing(myoAnalogRead()) ) {
Serial.println("You are not doing anything");
}
}
if( isIncreasing(rotationAboutY()) ) {
if( isIncreasing(myoAnalogRead()) ) {
Serial.println("You are tightening");
} else if( isDecreasing(myoAnalogRead()) ) {
Serial.println("This should not happen");
}
}
if( isDecreasing(rotationAboutY()) ) {
if( isIncreasing(myoAnalogRead()) ) {
Serial.println("You are untightening");
} else if( isDecreasing(myoAnalogRead()) ) {
Serial.println("This should not happen");
}
}
if( !isDecreasing(rotationAboutY()) ) {
if( isIncreasing(myoAnalogRead()) ) {
Serial.println("You are only tightening your muscle");
} else if( isDecreasing(myoAnalogRead()) ) {
Serial.println("You are not doing anything");
}
}
/* Wait the specified delay before requesting next data */
// delay(BNO055_SAMPLERATE_DELAY_MS);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment