Factory Monitor
Dependencies: mbed
factory sense HQ
Diff: main.cpp
- Revision:
- 5:faa8843f3990
- Parent:
- 4:7a50e0818a47
- Child:
- 6:e8819487b352
--- a/main.cpp Sat Aug 15 12:47:10 2015 +0000 +++ b/main.cpp Tue Aug 25 13:34:41 2015 +0000 @@ -1,8 +1,8 @@ #include "mbed.h" #define no_pins 2 -#define Inputs Values[0] -#define Outputs Values[1] +#define Inputs 0 +#define Outputs 1 #define Rejects Values[2] @@ -28,10 +28,14 @@ { // if the state has changed, check to see if it is a change from high to low or low to high if (sensorState == 1){ // if the current state is HIGH then increment the counter + if (a == Inputs){ lastSensorState[a] == sensorState;} + if (a == Outputs){ lastSensorState[a] == sensorState;} return sensorState; } - else { // if the current state is LOW then ignore + else { // if the current state is LOW then ignore + if (a == Inputs){ lastSensorState[a] == sensorState;} + if (a == Outputs){ lastSensorState[a] == sensorState;} return zero; } } @@ -51,7 +55,8 @@ int main() { - int Values[3]; // counter for the number of products passing through + int Values[3]; + while(1) {