Last active
December 10, 2015 04:38
-
-
Save dheaney/4382388 to your computer and use it in GitHub Desktop.
Force Sensor Logic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is our basic logic for parsing values from the force sensor.