SHARE
TWEET

Untitled

a guest May 22nd, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Wire.h>
  2. #include <I2CEncoder.h>
  3.  
  4. // Create an I2CEncoder for measuring the speed
  5. I2CEncoder rightEncoder;
  6. I2CEncoder leftEncoder;
  7.  
  8. void setup() {
  9.   Wire.begin(); // join i2c bus (address optional for master)
  10.   Serial.begin(9600);
  11.   rightEncoder.init(MOTOR_393_SPEED_ROTATIONS, MOTOR_393_TIME_DELTA);
  12.   leftEncoder.init(MOTOR_393_SPEED_ROTATIONS, MOTOR_393_TIME_DELTA);
  13.   rightEncoder.unTerminate();
  14.   leftEncoder.terminate();
  15.  
  16. }
  17.  
  18. void loop() {
  19.   Serial.print(rightEncoder.getSpeed()); Serial.print(','); Serial.println(leftEncoder.getSpeed());
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top