Advertisement
RuiViana

Test_I2C_ESP866_PCF8574

Apr 14th, 2018
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1.   #include <Wire.h>
  2.   //---------------------------
  3.   void setup()
  4.   {
  5.     Wire.begin(2,0);  // ESP8266
  6.     //Wire.begin();  // Arduino
  7.   }
  8.   //---------------------------  
  9.   void loop()
  10.   {                                                 // Se PCF8574A mude 38 para 20                                              
  11.     Wire.beginTransmission(0x38);                   // Begin the transmission to PCF8574
  12.     Wire.write(0);                                  // Zera as portas
  13.     Wire.endTransmission();                         // End the Transmission
  14.     delay(1000);                                    // Delay 1 seg
  15.     Wire.beginTransmission(0x38);                   // Begin the transmission to PCF8574
  16.     Wire.write(0xFF);                               // Liga todas portas
  17.     Wire.endTransmission();                         // End the Transmission    
  18.     delay(1000);                                    // Delay 1 seg
  19.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement