Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. struct Speeds {
  2. // struct
  3. int left;
  4. int right;
  5. };
  6.  
  7. Speeds new_speed;
  8. Speeds last_speed;
  9.  
  10. Speeds PID(int leftSensor, int rightSensor) {
  11. // create a new set of speeds
  12. Speeds motorSpeeds;
  13.  
  14. // default speed
  15. motorSpeeds.left = 80;
  16. motorSpeeds.right = 80;
  17.  
  18. // pid loop here!
  19.  
  20. // return the calculated speeds
  21. return motorSpeeds;
  22. }
  23.  
  24.  
  25. // the setup function runs once when you press reset or power the board
  26. void setup() {
  27. }
  28.  
  29. // the loop function runs over and over again forever
  30. void loop() {
  31. new_speed = PID(1,2);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement