Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- int tempo1 = 150;
- int tempo2 = 20;
- //---------------------------
- void setup()
- {
- Serial.begin(115200);
- //Wire.begin(2, 0); // ESP8266
- //Wire.begin(13, 0); // ESP8266
- //Wire.begin(4, 12); // ESP8266
- Wire.begin(); // Arduino
- }
- //---------------------------
- void loop()
- { // // Se PCF8574A mude 38 para 20
- for (int i = 1; i < 256; )
- {
- Serial.println(i, HEX);
- // int j = i<<4;
- Wire.beginTransmission(0x38); // Begin the transmission to PCF8574
- Wire.write(i);
- Wire.endTransmission(); // End the Transmission
- delay(tempo1); // Delay 1 seg
- i = i * 2;
- }
- for (int i = 1; i < 256; i++)
- {
- Serial.println(i, HEX);
- Wire.beginTransmission(0x38); // Begin the transmission to PCF8574
- Wire.write(i); // Grava as portas
- Wire.endTransmission(); // End the Transmission
- delay(tempo2); // Delay 1 seg
- }
- /* // Acende e apaga todos leds
- Wire.beginTransmission(0x38); // Begin the transmission to PCF8574
- Wire.write(0); // Zera as portas
- Wire.endTransmission(); // End the Transmission
- delay(1000); // Delay 1 seg
- Wire.beginTransmission(0x38); // Begin the transmission to PCF8574
- Wire.write(0xFF); // Liga todas portas
- Wire.endTransmission(); // End the Transmission
- delay(1000); // Delay 1 seg
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement