Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. void setup() {
  2. // put your setup code here, to run once:
  3.  
  4.  
  5. Serial.begin(9600);
  6. while (!Serial) {};
  7. Serial.println("start_tc_measurement");
  8.  
  9.  
  10. pinMode(myPinLed, OUTPUT);
  11. startTime = millis();
  12.  
  13. }
  14.  
  15.  
  16. void SerialListen() {
  17.  
  18. comString = "";
  19.  
  20. if (Serial.available() > 0) {
  21.  
  22. delay(10);
  23. bool stringComplete;
  24. stringComplete = false;
  25.  
  26. while (!stringComplete) {
  27. char inChar = (char)Serial.read();
  28. comString += inChar;
  29. if (inChar == '\n') stringComplete = true;
  30. }
  31.  
  32. Serial.println(String("Command received = ") + comString);
  33.  
  34. if (comString.startsWith("stop")) state = 0;
  35. if (comString.startsWith("run")) state = 1;
  36. if (comString.startsWith("set")) state = 2;
  37.  
  38. }
  39. //Serial.println(command);
  40. //if (command.startsWith("setfun")) Serial.println("Set Function");
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement