Final industrial end node software
Dependencies: mbed
Revision 1:13d222b50e8e, committed 2018-05-15
- Comitter:
- jmckneel
- Date:
- Tue May 15 22:48:20 2018 +0000
- Parent:
- 0:3845f08fcd02
- Commit message:
- Final industrial end node software
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 3845f08fcd02 -r 13d222b50e8e main.cpp --- a/main.cpp Tue May 15 21:51:13 2018 +0000 +++ b/main.cpp Tue May 15 22:48:20 2018 +0000 @@ -568,8 +568,9 @@ printf("Initializing software parameters.\r\n"); uint8_t c_buff[10]; bool skittle = false; - int jamCount = 0; // Stops the motor if checks and is jammed twice consecutive - int stirCount = 0; // When it reaches 3, the machine stirs the reservoir + int jamCount = 0; // Stops the motor if checks and is jammed twice consecutive + int stirCount = 0; // When it reaches 50, the machine stirs the reservoir + int stirredCount = 0; // When it reaches 5, the machine stops // 5.) Test the slide PWM slide_pwm.pulsewidth_us(1200); @@ -633,6 +634,7 @@ skittle = true; set_slide_servo(c_buff[0]); stirCount = 0; + stirredCount = 0; } // iii.) Check the XBee buffer for parsing @@ -648,11 +650,19 @@ stir(); stir(); stirCount = 0; // Reset the stir count + stirredCount = stirredCount + 1; } else if(stirCount >= 50){ stirCount = 0; } dispense_skittles(); // Dispense any skittles + + // v.) Handle stirred + if (stirredCount >= 5){ + geneva_pwm.pulsewidth_us(GENEVA_STOP); + set_slide_servo(5); + return 0; + } } // d.) Increment/full receptacle control