Guest User

Untitled

a guest
Mar 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. /*************************************************************
  2. * Final Cumulative Program
  3. * used for Telemetry
  4. *
  5. * Code Definitions:
  6. * 1 : Stop
  7. * 2 : Pause
  8. * 3 : Play
  9. * c : Connected
  10. *************************************************************/
  11.  
  12. #include <Prototypes.h>
  13.  
  14. void setup()
  15. {
  16. Serial.begin(9600); //Global Baud Rate
  17.  
  18. MotorControlSetup();
  19. LuxSensorSetup();
  20. LVDT_SensorSetup();
  21. //current sensor setup
  22. }
  23.  
  24. void loop()
  25. {
  26. for(;;)
  27. {
  28. int serialInput = Serial.read();
  29. switch (serialInput)
  30. {
  31. case '1': //STOP
  32. case '2': //PAUSE
  33. MotorOFF();
  34. break;
  35. case '3': //PLAY
  36. playCase();
  37. break;
  38. case 'c': //CONNECTED
  39. connectedMessage();
  40. break;
  41. }
  42. }
  43. }
  44.  
  45. void connectedMessage()
  46. {
  47. Serial.print('n');
  48. Serial.print("Connection Established...");
  49. Serial.print('n');
  50. Serial.print("Status: Standby ---> Ready to Dig");
  51. Serial.print('n');
  52. }
  53.  
  54. void stopCase(void)
  55. {
  56. //Stop Motor
  57. //Print No Serial Data
  58. }
  59.  
  60. void playCase(void)
  61. {
  62. for(;;)
  63. {
  64. LVDT_SensorLoop();
  65. LuxSensorLoop();
  66. //Current Sensor Loop
  67. MotorON();
  68. if(serialInput != '3') return;
  69. }
  70. }
Add Comment
Please, Sign In to add comment