Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*************************************************************
- * Final Cumulative Program
- * used for Telemetry
- *
- * Code Definitions:
- * 1 : Stop
- * 2 : Pause
- * 3 : Play
- * c : Connected
- *************************************************************/
- #include <Prototypes.h>
- void setup()
- {
- Serial.begin(9600); //Global Baud Rate
- MotorControlSetup();
- LuxSensorSetup();
- LVDT_SensorSetup();
- //current sensor setup
- }
- void loop()
- {
- for(;;)
- {
- int serialInput = Serial.read();
- switch (serialInput)
- {
- case '1': //STOP
- case '2': //PAUSE
- MotorOFF();
- break;
- case '3': //PLAY
- playCase();
- break;
- case 'c': //CONNECTED
- connectedMessage();
- break;
- }
- }
- }
- void connectedMessage()
- {
- Serial.print('n');
- Serial.print("Connection Established...");
- Serial.print('n');
- Serial.print("Status: Standby ---> Ready to Dig");
- Serial.print('n');
- }
- void stopCase(void)
- {
- //Stop Motor
- //Print No Serial Data
- }
- void playCase(void)
- {
- for(;;)
- {
- LVDT_SensorLoop();
- LuxSensorLoop();
- //Current Sensor Loop
- MotorON();
- if(serialInput != '3') return;
- }
- }
Add Comment
Please, Sign In to add comment