I back to basic and start from a simply blink working program.
When I add my previous I2C test code, it stop working (no blink !)
Then I remove my command one by one and discover than the .setClock is the problem !!
look at this code :
Code: Select all
/*
Test i2C
*/
#include <Wire.h>
#define LED_BUILTIN PC13
TwoWire I2C_Alternate(PB9, PB8);
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
//!\ => if I set the I2C clock => Program stop to run !!
//I2C_Alternate.setClock(400000);
I2C_Alternate.begin();
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
I2C_Alternate.beginTransmission(4);
I2C_Alternate.write(0xAA);
I2C_Alternate.endTransmission();
}
but if you uncomment the setClock, program no working anymore (no blink !)
What's wrong on this setClock ?
Could some people confirm this fact before I post an Issue ?
Thanks