Documentation of the RDOT_ECD_I2C library for the Rdot driver board 4. Before you read this we recommend reading the Driver 4 Tutorial.
Download and including the library
Download the library here and install it in the Arduino IDE. To include the library in your sketch use:#include <RDOT_ECD_I2C_1.0.h>
Create an instance of the ECD object
RDOT_ECD ECD(int address, int number_of_segments);
address
is the I2C address of the Rdot display driver (generally 43).number_of_segments
is the number of segments on the display.
Updating the display
ECD.set(int state[]);
The display is updated to a new state by passing an array of ones and zeros in the set(bool array[])
function. Number 1 indicates segment on (dark) and zero indicates segment off (bright). Each digit in the array correspond to one segment on the display. For example:
bool new_state[7] = {1,0,1,0,1,0,1}; //Every second segment is dark and the others are bright.
ECD.set(new_state);
Refresh the display
ECD.refresh();
Applies a refresh pulse on the segments to increase the contrast without changing the display content (recommended if the display hasn't been updated for 15 minutes or so).
Set Switching Time
ECD.setSwitchingTime(int time);
Changes the switching time to time
in milliseconds, the default value is 2200 ms. Longer switching time generally means better contrast but it should not be longer than necessary as that influences display lifetime.
Set Counter Voltage
ECD.setCounterVoltage(float voltage);
Changes the counter voltage to voltage
. The value should be between 0 and 5 V, default is 2,4 V. Lower counter voltage means more contrast in dark state and less contrast in bright state while higher voltage means more contrast in bright state and less in dark state.
Reset
ECD.reset();
Applies a reset sequence to the display and removes all content.
Custom functions for specific designs
These functions are designed for specific display designs. You can still use the set()
function to achieve the same result but these functions will save you some time.
Single Seven Segment Display (1x7)
ECD.setNumber1x7(int number);
Used to update the 7-segment display to a digit between 0 and 9.
Double Seven Segment Display (2x7)
ECD.setNumber2x7(int number);
Used to update the double 7-segment display to a digit between -99 and 99.
Bar Display
ECD.setBar(int number);
Used to update the bar display to a state between 0 (zero bars on) and 7 (all bars on) from the bottom and up. For example, the ECD.setBar(5)
function turns on 5 of the 7 bar segments.