Advertisement
Gibcio2021

Untitled

Oct 18th, 2021
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <Servo.h>
  2. #define SERVO_A 46
  3. #define SERVO_B 44
  4. Servo serwo1;
  5. Servo serwo2;
  6. String DaneWemos = "";
  7. String WemosParam1 = "";
  8. String WemosParam2 = "";
  9. String WemosParam3 = "";
  10. void setup()
  11. {
  12. Serial.begin(115200);
  13. Serial3.begin(115200);
  14. serwo1.attach(SERVO_A);
  15. serwo1.write(90);
  16. serwo2.attach(SERVO_B);
  17. serwo2.write(90);
  18. }
  19. void loop()
  20. {
  21. if(Serial3.available())
  22. {  
  23. DaneWemos = Serial3.readStringUntil('\n');
  24. WemosParam1 = DaneWemos.substring(0, DaneWemos.indexOf(":"));
  25. WemosParam2 = DaneWemos.substring(DaneWemos.indexOf(":")+1, DaneWemos.lastIndexOf(":"));
  26. WemosParam3 = DaneWemos.substring(DaneWemos.lastIndexOf(":")+1);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement