Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import serial
  2. arduino_port = "com23"
  3. ArduinoSerial = serial.Serial(arduino_port,2000000)
  4.  
  5. while True:
  6. ard_command = ArduinoSerial.readline()
  7. value = (ard_command)
  8. myString = str(value)
  9. if myString == "test":
  10. print("if")
  11. else :
  12. print(myString)
  13.  
  14. const int buttonPin = 2; // the number of the pushbutton pin
  15. int buttonState; // variable for reading the pushbutton status
  16. int i=0;
  17. int j=77;
  18. void setup() {
  19. Serial.begin(2000000);
  20. pinMode(buttonPin, INPUT);
  21. }
  22.  
  23. void loop() {
  24. buttonState = digitalRead(buttonPin);
  25. delay(100);
  26.  
  27. if (buttonState == HIGH){
  28. Serial.println("test");}
  29.  
  30. else{Serial.println(i);}
  31.  
  32. i++;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement