Documentation of the RDOT_ECD library for the Rdot Arduino shield V2.2. Before you read this we recommend reading the Rdot Arduino shield 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_x.y.h>
Create an instance of the ECD object
RDOT_ECD ECD(int common, int segments[], int number_of_segments, int counter_voltage, int switching_time);
common
is the common electrode pin.segments
is an array of all the segment pins.number_of_segments
is the total number of connected display segments.counter_voltage
is the voltage on the counter electrode, should be in the range 0-255, the resulting voltage will be 5*counter_voltage/255. 120 is normally a good choice.swiching_time
is the number of milliseconds the switching cycle is active.
Initialize the display
ECD.init();
Removing all potential content on the display. Recommended to call in the void Setup()
method.
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);
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 ECD.setBar(5)
turns on 5 of the 7 bar segments.
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).