Bonezegei PCF8574: Arduino Library for I2C Input Output Expander
Batutay, Jofel ยท 2023/10/27

This paper presents an overview of the Bonezegei PCF8574 library, an Arduino library for I2C input output expander. The PCF8574 is a device that allows users to expand the number of digital input/output pins of a microcontroller via the I2C bus (Texas Instruments, 2016). The Bonezegei library provides functions for basic port manipulation, such as reading and writing to the pins (Batutay, 2023). The paper demonstrates the installation of the library on Arduino 2 IDE and shows examples of how to use the library functions in various scenarios.

Disclaimer

The code and libraries provided by Bonezegei is intended for informational and educational purposes only. Bonezegei does not own or manufacture the hardware associated with the code. The code is provided "as is" without any warranty, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall Bonezegei be liable for any claim, damages, or other liability arising from the use of the code or the hardware. Users are solely responsible for ensuring that their use of the code complies with all applicable laws and regulations.


1. Read Port

/*
  Read Port
  Author: Bonezegei (Jofel Batutay)
  Date:  January 2024
*/

#include <Bonezegei_PCF8574.h>

Bonezegei_PCF8574 io(0x27);

void setup() {
  Serial.begin(115200);
  io.begin();
}

void loop() {
  Serial.printf("Port:%x \n" , io.read());  //Read IO
  delay(1000);
}

2. Read and Write

/*
  Read and Write (LED connected on P0 will blink every second)
  Author: Bonezegei (Jofel Batutay)
  Date:  January 2024

  P0 connect an LED   (Output)
  P1 Conect a switch  (Input)
*/

#include <Bonezegei_PCF8574.h>

Bonezegei_PCF8574 io(0x27);

void setup() {
  Serial.begin(115200);
  io.begin();
}

void loop() {
  io.write(0xa0);                           //Write to IO
  Serial.printf("data:%x \n" , io.read());  //Read IO
  delay(1000);

  io.write(0xa1);
  Serial.printf("data:%x \n" , io.read());
  delay(1000);
}

References

  1. Texas Instruments. (2016). Remote 8-bit I/O expander for I2C-bus with interrupt. https://www.ti.com/lit/ds/symlink/pcf8574.pdf
  2. Batutay, J. (2023). Arduino Library Installation on Arduino 2 IDE: Bonezegei Library. ResearchGate. https://www.researchgate.net/publication/376862516_Arduino_Library_Installation_on_Arduino_2_IDE_Bonezegei_Library

Cite this

  1. Batutay, Jofel. (2024). Bonezegei PCF8574: Arduino Library for I2C Input Output Expander. ResearchGate. https://doi.org/10.13140/RG.2.2.24957.74729.