Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Speeds {
- // struct
- int left;
- int right;
- };
- Speeds new_speed;
- Speeds last_speed;
- Speeds PID(int leftSensor, int rightSensor) {
- // create a new set of speeds
- Speeds motorSpeeds;
- // default speed
- motorSpeeds.left = 80;
- motorSpeeds.right = 80;
- // pid loop here!
- // return the calculated speeds
- return motorSpeeds;
- }
- // the setup function runs once when you press reset or power the board
- void setup() {
- }
- // the loop function runs over and over again forever
- void loop() {
- new_speed = PID(1,2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement