All Projects → xreef → PCF8574_library

xreef / PCF8574_library

Licence: Unknown, Unknown licenses found Licenses found Unknown LICENSE Unknown LICENSE.md
i2c digital expander for Arduino, esp32, SMT32 and ESP8266. Can read write digital values with only 2 wire. Very simple to use and encoder support.

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to PCF8574 library

PCF8591 library
Library to use i2c analog IC with arduino and esp8266. Can read analog value and write analog value with only 2 wire (perfect for ESP-01).
Stars: ✭ 24 (-83.45%)
Mutual labels:  i2c, expander, esp-01
PCF8575 library
Library to use i2c digital expander with arduino, esp8266 and esp32. Can read write digital value with only 2 wire (perfect for ESP-01).
Stars: ✭ 28 (-80.69%)
Mutual labels:  digital, i2c, expander
esp-01-WiFi-Scanner-ESP-01-OLED-I2C-Display
Scanner WiFi avec écran OLED I2C (SSD1306) sur un ESP-01 (ESP8266)
Stars: ✭ 21 (-85.52%)
Mutual labels:  i2c, esp-01
NR1-UI
Userinterface for Volumio (RaspberryPi) with ssd1322 and ssd1306 oled display, spectrum bargraph, progress bar, LED functions, Standby-functions, 4 Buttons and Rotary Encoder.
Stars: ✭ 29 (-80%)
Mutual labels:  i2c, pcf8574
anytone-flash-tools
Independend flash tools for Anytone D878UV radio (and maybe others)
Stars: ✭ 31 (-78.62%)
Mutual labels:  digital
SoftWire
Software I2C implementation for Arduino and other Wiring-type environments
Stars: ✭ 105 (-27.59%)
Mutual labels:  i2c
io
Go drivers for pheripheral I/O on Linux.
Stars: ✭ 20 (-86.21%)
Mutual labels:  i2c
tinnymodbus
RS485 ModBus tiny multi-sensor module
Stars: ✭ 75 (-48.28%)
Mutual labels:  i2c
MPU-9250-Sensors-Data-Collect
MPU9250 (MPU6500 + AK8963) I2C Driver in Python for Raspbery PI
Stars: ✭ 51 (-64.83%)
Mutual labels:  i2c
nanopack
Lightweight Msgpack Encoder
Stars: ✭ 15 (-89.66%)
Mutual labels:  encoder
gonvert
Golang character encoding converter with an automatic code-estimation.
Stars: ✭ 24 (-83.45%)
Mutual labels:  encoder
sms
A Go library for encoding and decoding SMSs
Stars: ✭ 37 (-74.48%)
Mutual labels:  encoder
go-bsbmp
Golang library to interact with Bosch Sensortec BMP180/BMP280/BME280/BMP388 temperature, pressure and humidity sensors via I2C-bus from Raspberry PI.
Stars: ✭ 41 (-71.72%)
Mutual labels:  i2c
TLV493D-A1B6-3DMagnetic-Sensor
Library for the TLV493D-A1B6 3D magnetic sensor for Arduino.
Stars: ✭ 27 (-81.38%)
Mutual labels:  digital
SAE-Desafia
Desafio para o futuro Mestre Jedi do @saedigital
Stars: ✭ 21 (-85.52%)
Mutual labels:  digital
alkemio
START HERE! Cross project collaboration and shared documentation.
Stars: ✭ 22 (-84.83%)
Mutual labels:  digital
netcoin
Netcoin - Digital currency with personal interest rate and fair weight stake mining
Stars: ✭ 18 (-87.59%)
Mutual labels:  digital
USB-Rubber-Ducky-App
🐣 Windows GUI for USB Rubber Ducky
Stars: ✭ 63 (-56.55%)
Mutual labels:  encoder
urlpack
Pure JavaScript toolkit for data URLs (MessagePack, Base58 and Base62)
Stars: ✭ 51 (-64.83%)
Mutual labels:  encoder
logfmt
Package logfmt marshals and unmarshals logfmt messages.
Stars: ✭ 156 (+7.59%)
Mutual labels:  encoder
Support forum pcf8574 English
Forum supporto pcf8574 italiano

Additional information and documentation on my site: pcf8574 Article.

If you need more pins here you can find the pcf8575 16bit version of the IC.

Version 2.2

Library to use I2C analog IC with arduino and esp8266. Can read and write digital value with only 2 wires (perfect for ESP-01).

Tutorial:

To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder PCF8574. Check that the PCF8574 folder contains PCF8574\\.cpp and PCF8574.h. Place the DHT library folder your <arduinosketchfolder>/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE.

Changelog

10/08/2022: v2.3.4 Add support for custom SERCOM interface of Arduino SAMD devices. Force SDA SCL to use GPIO numeration for STM32 bug (https://www.mischianti.org/forums/topic/compatible-with-stm32duino/). 28/07/2022: v2.3.3 Force SDA SCL to use GPIO numeration (https://www.mischianti.org/forums/topic/cannot-set-sda-clk-on-esp8266/). 28/07/2022: v2.3.2 Fix the SDA SCL type #58 and add basic support for SAMD device. 26/04/2022: v2.3.1 Fix example for esp32 and double begin issue #56. 06/04/2022: v2.3.0 Fix package size 30/12/2021: v2.2.4 Minor fix and remove deprecated declaration 23/11/2020: v2.2.2 Add multiple implementation for encoder management (you can enable by uncomment relative define)

Reef complete PCF8574 PCF8574AP digital input and output expander with i2c bus.

I try to simplify the use of this IC, with a minimal set of operations.

PCF8574P address map 0x20-0x27 PCF8574AP address map 0x38-0x3f

Constructor: Pass the address of I2C (to check the address use this guide I2cScanner)

	PCF8574(uint8_t address);

For ESP8266 if you want to specify SDA and SCL pins use this:

	PCF8574(uint8_t address, uint8_t sda, uint8_t scl);

You must set input/output mode:

	pcf8574.pinMode(P0, OUTPUT);
	pcf8574.pinMode(P1, INPUT);
	pcf8574.pinMode(P2, INPUT);

then IC as you can see in the image has 8 digital input/output ports:

PCF8574 schema

To read all analog input in one trasmission you can do (even if I use a 10millis debounce time to prevent too much read from i2c):

	PCF8574::DigitalInput di = PCF8574.digitalReadAll();
	Serial.print(di.p0);
	Serial.print(" - ");
	Serial.print(di.p1);
	Serial.print(" - ");
	Serial.print(di.p2);
	Serial.print(" - ");
	Serial.println(di.p3);

To follow a request (you can see It on issue #5) I create a define variable to work with low memory devices, if you uncomment this line in the .h file of the library:

// #define PCF8574_LOW_MEMORY

Enable low memory props and gain about 7 bytes of memory, and you must use the method to read all like so:

   byte di = pcf8574.digitalReadAll();
   Serial.print("READ VALUE FROM PCF: ");
   Serial.println(di, BIN);

where di is a byte like 1110001, so you must do a bitwise operation to get the data, operation that I already do in the "normal" mode. For example:

   p0 = ((di & bit(0))>0)?HIGH:LOW;
   p1 = ((di & bit(1))>0)?HIGH:LOW;
   p2 = ((di & bit(2))>0)?HIGH:LOW;
   p3 = ((di & bit(3))>0)?HIGH:LOW;
   p4 = ((di & bit(4))>0)?HIGH:LOW;
   p5 = ((di & bit(5))>0)?HIGH:LOW;
   p6 = ((di & bit(6))>0)?HIGH:LOW;
   p7 = ((di & bit(7))>0)?HIGH:LOW;

if you want to read a single input:

	int p1Digital = PCF8574.digitalRead(P1); // read P1

If you want to write a digital value:

	PCF8574.digitalWrite(P1, HIGH);

or:

	PCF8574.digitalWrite(P1, LOW);

You can also use an interrupt pin: You must initialize the pin and the function to call when interrupt raised from PCF8574

// Function interrupt
void keyPressedOnPCF8574();

// Set i2c address
PCF8574 pcf8574(0x39, ARDUINO_UNO_INTERRUPT_PIN, keyPressedOnPCF8574);

Remember you can't use Serial or Wire on an interrupt function.

It's better to only set a variable to read on loop:

void keyPressedOnPCF8574(){
	// Interrupt called (No Serial no read no wire in this function, and DEBUG disabled on PCF library)
	 keyPressed = true;
}

For the examples I use this wire schema on breadboard: Breadboard

https://downloads.arduino.cc/libraries/logs/github.com/xreef/PCF8574_library/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].