This library is a collection for the Arduino and ESP32 for two modules on the Joy-Pi Advanced. See here for more information.
This library includes the following modules:
ADC_TLA2518gyroscope_ICG_1020SRGB_MatrixKeypad_MCP
Note
This is a list of all necessary libraries that are needed for the Joy-Pi Advanced and the Arduino Nano or ESP32. All these libraries are set as dependencies and will be automatically installed in the Arduino IDE.
| Repository | Needed for |
|---|---|
ADC_TLA2518 |
Library to use the Analog-Digital-Converter |
gyroscope_ICG_1020S |
Library to use the gyroscope |
RGB_Matrix |
Library to use the led matrix on Joy-Pi Advanced 2 - RP2040 is used to communicate with led matrix |
Adafruit NeoPixel |
Library to use the led matrix on Joy-Pi Advanced (older versions) - led matrix is directly connected to microcontroller |
Keypad_MCP Keypad |
Library to use the button matrix |
MFRC522 |
Library to use the RFID module |
OneWire |
Library for OneWire communication to use the DS18B20 |
Servo |
Library to use the servo motor with Arduino Nano |
ESP32Servo |
Library to use the servo motor with ESP32 |
VEML6040 |
Library to use the colour sensor |
Adafruit MPR121 Adafruit BusIO |
Library to use the touch pads |
DHT sensor library Adafruit Unified Sensor |
Library to use the DHT11 |
hd44780 |
Library to use the 16x2 LCD |
IRremote |
Library to use the infrared sensor and easily decode the signal |
Adafruit SSD1306 Adafruit GFX Library Adafruit BusIO |
Library to use OLED display |
SSD1306Ascii |
Library to use OLED for project interactive safe because other library needs more dynamic memory |
Adafruit ST7735 and ST7789 Library Adafruit GFX Library Adafruit seesaw Library Adafruit BusIO SD |
Library to use the TFT display |
RTCDS1307 |
Library to use the Real Time Clock |
MS5xxx |
Library to use the barometer |
PinChangeInterrupt |
Library to use other pins as interrupt than the interrupt pins on the Arduino Nano |
ADC_TLA2518(int CS, int SPI_CLK, int MISO, int MOSI, int SCLK, SPIClass* spi = &SPI)- initialize ADCvoid begin()- starts communicationint read_adc_value(int channel)- returns raw value from a selected channeldouble read_voltage(int channel, int value = -1)- returns measured voltage from a selected channel, raw value can also be calculated into voltage with this method
gyroscope_ICG_1020S(int CS, int SPI_CLK, int MISO, int MOSI, int SCLK, SPIClass* spi = &SPI)- initialize gyroscopevoid begin()- starts communicationdouble getTemperature()- returns measured temperatureString getTilt()- returns the tilted directionvoid setScale(int factor, int gyroscope, int range, int offset)- sets scale factors of the gyroscopeint whoAmI()- returns specified value to identify itself
RGB_Matrix(int i2c_address = 0x66, uint8_t led_count = 64, uint8_t brightness = 10, const uint8_t* left_border=_default_left_border, const uint8_t* right_border=_default_right_border, TwoWire* awire = &Wire)- initialize led matrix with default valuesvoid begin()- starts communication with RP2040 chip to communicate with led matrixvoid show()- displays set pixelsvoid clean()- clears the LED matrixvoid setPixel(uint8_t position, RGBW colour)- ts specific pixel to a selected colour withRGBW-objectvoid colorWipe(RGBW colour, uint8_t wait_ms=50)- Move selected colour pixel by pixel onto the matrix with default speedvoid rainbow(uint8_t wait_ms=20, uint8_t iterations=1)- rainbow effect on the whole matrix with default valuesvoid theaterChase(RGBW colour, uint8_t wait_ms=50, uint8_t iterations=10)- chaser animation with a selected colour with deafult speedvoid RGB_on(RGBW colour)- sets the complete matrix to one selected colourvoid RGB_off()- turns the complete matrix offRGBW wheel(uint8_t position)- helpervoid demo1()- demo program version 1void demo2()- demo program version 2void setBrightness(uint8_t brightness)- set brightness of led matrixuint8_t getPixelNumber()- returns number of pixel
Note
This object is for an easier and more flexible use of colour codes. You can use the hexadecimal value, separate RGB values or separate RGBW values.
RGBW(uint32_t color)- constructor for hexadecimal colour valueRGBW(uint8_t r, uint8_t g, uint8_t b)- constructor for separate RGB valuesRGBW(uint8_t r, uint8_t g, uint8_t b, uint8_t w)- constructor for separate RGBW values
Note
This library is copied into this repository because it is normally necessary to download it and to manually install it. Therefore, to make the installation easier, the files are included in this repository. The licence of the library can be found here.
Keypad_MCP(char* userKeymap, byte* row, byte* col, byte numRows, byte numCols, byte address, TwoWire * awire=&Wire)- initialize button matrix with keymap, array with pins of MCP which are the rows, array with pins of MCP which are the columns, number of rows, number of columns and I2C addresvoid begin(char *userKeymap)- start communication with defined keymap (how buttons are arranged)void begin(void)- start communication with already set keymapvoid pin_mode(byte pinNum, byte mode)- set a certain pin of MCP as input(INPUT) or output(OUTPUT) in the IODIR registervoid pin_write(byte pinNum, boolean level)- set value of a certain pin of MCPint pin_read(byte pinNum)- get current state of a certain pin of MCPbyte pinState_set( )- get current state of all 8 bits of the portvoid port_write( byte i2cportval )- write a whole byte to i2c portbyte iodir_read( )- get current state of all 8 bits of MCP IODIR registervoid iodir_write( byte iodir )- write value to all 8 bits of MCP IODIR register
Note
Keypad_MCP inherts from Keypad.
Therefore the following methods can also be used with Keypad_MCP
char getKey()- returns one key which was pressedbool getKeys()- returns true if a key was pressedKeyState getState()- returns state of keysbool isPressed(char keyChar)- return if a certain key was pressedvoid setDebounceTime(uint)- set debounce time of button matrix (min = 1 ms)void setHoldTime(uint)- set hold time of button matrix (how long a key has to be pressed to be recognized)void addEventListener(void (*listener)(char))-int findInList(char keyChar)- searches by character for a key in list of active keys (returns -1 if none is found)int findInList(int keyCode)- searches by code for a key in list of active keys (returns -1 if none is found)char waitForKey()- blocks everything till a key was pressedbool keyStateChanged()- returns true if state of any key changedbyte numKeys()- returns number of keys in the key listtypedef enum{ IDLE, PRESSED, HOLD, RELEASED } KeyState- enum to define possible states of a key