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[MAX_BUFFER_ADDR_PK] = {};
- bool ok = true;
- void setup(){
- Serial.begin(115200);
- Wire.begin(SDA_PIN, SCL_PIN);
- Wire.setClock(100);
- }
- void loop() {
- strcpy(addrpk, "{\"bc1qjaz2248t09y98vaqguq2560t7kclhesapce5sf\":\"KxdK7M6b148NsEyH6EvR91xSWN27uzCxYfhgdRznZEZfX7Kkr9Rh\"}");
- using periodic = esp8266::polledTimeout::periodicMs;
- static periodic nextPing(1000);
- if(nextPing && ok){
- GOT_HERE();
- Wire.beginTransmission(I2C_SLAVE_ADDR7);
- GOT_HERE();
- Wire.write(addrpk);
- GOT_HERE();
- Wire.endTransmission();
- GOT_HERE();
- Wire.requestFrom(I2C_SLAVE_ADDR7, strlen(addrpk));
- 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