mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
Migrate from astyle to clang-format (#8464)
This commit is contained in:
committed by
Max Prokhorov
parent
46190b61f1
commit
19b7a29720
@ -18,24 +18,23 @@ const int16_t I2C_MASTER = 0x42;
|
||||
const int16_t I2C_SLAVE = 0x08;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // start serial for output
|
||||
Serial.begin(115200); // start serial for output
|
||||
|
||||
Wire.begin(SDA_PIN, SCL_PIN, I2C_SLAVE); // new syntax: join i2c bus (address required for slave)
|
||||
Wire.onReceive(receiveEvent); // register event
|
||||
Wire.begin(SDA_PIN, SCL_PIN, I2C_SLAVE); // new syntax: join i2c bus (address required for slave)
|
||||
Wire.onReceive(receiveEvent); // register event
|
||||
}
|
||||
|
||||
void loop() {
|
||||
}
|
||||
void loop() {}
|
||||
|
||||
// function that executes whenever data is received from master
|
||||
// this function is registered as an event, see setup()
|
||||
void receiveEvent(size_t howMany) {
|
||||
|
||||
(void) 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
|
||||
(void)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.println(x); // print the integer
|
||||
int x = Wire.read(); // receive byte as an integer
|
||||
Serial.println(x); // print the integer
|
||||
}
|
||||
|
Reference in New Issue
Block a user