Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #define GOT_HERE() do {Serial.print('['); Serial.print(__LINE__); Serial.println(']'); Serial.flush();} while(0)
- #define MAX_BUFFER_ADDR_PK 102
- #define SDA_PIN 4
- #define SCL_PIN 5
- const int I2C_SLAVE_ADDR0 = 0x50;
- const int I2C_SLAVE_ADDR1 = 0x51;
- const int I2C_SLAVE_ADDR2 = 0x52;
- const int I2C_SLAVE_ADDR3 = 0x53;
- const int I2C_SLAVE_ADDR4 = 0x54;
- const int I2C_SLAVE_ADDR5 = 0x55;
- const int I2C_SLAVE_ADDR6 = 0x56;
- const int I2C_SLAVE_ADDR7 = 0x57;
- char addrpk[] = {"\{\"bc1qjaz2248t09y98vaqguq2560t7kclhesapce5sf\":\"KxdK7M6b148NsEyH6EvR91xSWN27uzCxYfhgdRznZEZfX7Kkr9Rh\"\}"};
- bool ok = true;
- int writt = 0;
- int status = 0;
- void setup(){
- Serial.begin(115200);
- Wire.begin(SDA_PIN, SCL_PIN);
- // Wire.setClock(100);
- }
- void loop() {
- using periodic = esp8266::polledTimeout::periodicMs;
- static periodic nextPing(1000);
- if(nextPing && ok){
- // GOT_HERE();
- Wire.beginTransmission(I2C_SLAVE_ADDR7);
- // GOT_HERE();
- writt = Wire.write(addrpk);
- Serial.print("Written ");
- Serial.print(writt);
- Serial.println(" bytes!");
- // GOT_HERE();
- Serial.print("Wire endTrans: ");
- Serial.println(Wire.endTransmission());
- // GOT_HERE();
- status = Wire.requestFrom(I2C_SLAVE_ADDR7, strlen(addrpk));
- Serial.print("Wire reqFrom: ");
- Serial.println(status);
- // GOT_HERE();
- while( Wire.available() ){
- char c = Wire.read();
- Serial.print(c);
- // GOT_HERE();
- }
- ok = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement