I’m trying to decode the I2c output of the jupyter notebook for the jetbot.
I’ve connected an arduino to the I2c and am reading the output string using the wire.h library.
The output I get is around 60 characters long for just setting the left motor to %30.
It looks nothing like what I expected eg. pwm.setPWM(15, 1024, 3072).
I’ve tried BIN, HEX etc.
The other thing I noticed was that the string of numbers (in hex) didn’t change when the motor was set to a different speed?
Arduino Slave sketch:
``void setup() {
Wire.begin(0x27); // join i2c bus with address, also changed in Jupyterlab
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
}
void loop() {
delay(100);
}
// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany) {
while (1 < Wire.available()) { // loop through all but the last
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
}
int x = Wire.read(); // receive byte as an integer
Serial.print(x,BIN); // print
}
you should refer to Technical Reference Manual, see [CHAPTER 35: I2C CONTROLLER] for descriptions and offsets of all registers.
instead of using configured serial rate, why don’t you simply check the register values.
please eliminating character encoding related issue, you should just check the values in hex.
thanks