-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot get I2C communication to raspberry pi to work #303
Comments
Hi, To be clear, is I2C support even something that should be available? Because I was a little bit confused about not finding any reference to it in the official e-manual. If messing around with HAL or the Lower Layer of the Stm32 MC is the only way to get I2C working, I will have to move on for now and use an Arduino. |
I tried connecting the RP using the following Arduino code:
`
#include <Wire.h>
void setup()
{
Wire.begin(11); // join i2c bus with address #11
Wire.onReceive(receiveEvent); // register event
Serial.begin(115200); // start serial for output
}
String msg = "";
boolean reset = false;
char current;
char previous;
void loop()
{
}
void receiveEvent(int howMany)
{
//msg = "";
while(Wire.available())
{
char current = Wire.read();
msg += current;
//Serial.println("current: " + String(current) + " pre: " + String(previous));
if(current == ';' && previous == ';'){
//Serial.println("c == 10");
//msg = "";
reset = true;
//break;
}
previous = current;
}
if(reset == true){
Serial.println(msg);
msg = "";
reset = false;
}
}`
On a standard Arduino, this works, but the opencr board does not get recognised as an i2c device. I looked at the libraries in the repository, trying to make sense of them, but I had to give up. Sadly this functionality is also not documented in the e-manual.
What methods and libraries do I need to use to establish an i2c connection with the board?
Regards,
Daniel
The text was updated successfully, but these errors were encountered: