Skip to content

Instantly share code, notes, and snippets.

@dheaney
Last active December 10, 2015 04:38
Show Gist options
  • Save dheaney/4382388 to your computer and use it in GitHub Desktop.
Save dheaney/4382388 to your computer and use it in GitHub Desktop.
Force Sensor Logic
#pragma config(Sensor, S2, snsrforce, sensorLightInactive)
bool checkWeight(int sensor_value) {
const int thresh = 375;
bool weighted;
if(sensor_value > thresh) {
weighted = true;
} else {
weighted = false;
}
}
task main() {
int force = 0;
eraseDisplay();
while(true) {
force = SensorRaw[snsrforce];
nxtDisplayCenteredTextLine(2, "%i", checkWeight(force));
nxtDisplayCenteredTextLine(3, "sensor value: %i", force);
}
}
@dheaney
Copy link
Author

dheaney commented Dec 26, 2012

This is our basic logic for parsing values from the force sensor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment