Ruslan_nig

changeI2C_id

Dec 15th, 2021
1,147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Wire.h>
  2. uint8_t id = 1;
  3. void setup() {
  4.       Wire.begin();//инициализируем библиотеку wire
  5.       Serial.begin(9600);
  6.      
  7.   Wire.beginTransmission(id); //Begin a transmission to the I2C slave device with the given address
  8.   Wire.write(0x25);//controller enable
  9.   Wire.endTransmission();
  10.  
  11.   Wire.beginTransmission(id);
  12.   Wire.write(0x24);//changes id
  13.   Wire.write(0x02);//какой будет новый id
  14.   Wire.endTransmission();
  15. }
  16.  
  17. void loop() {
  18. }
Advertisement
Add Comment
Please, Sign In to add comment