You are viewing an older revision! See the latest version
RS Display Board
This is a purpose built breakout board, utilizing the PCA9635 IO bus expander as an LED driver. The dispBoB library requires the inclusion of the PCA9635 library in order to function correctly.
Functionality¶
The library is set up such that it is possible to illuminate individual LEDs or simply send strings to the display, for which there are two separate options.
void write(string str) - this simply displays a 6 character long max. string statically.
void scroll(string str, float speed) - this takes strings of any length and scrolls them across the display, each frame lasts for a duration, specified by the speed parameter.
Example Projects¶
The display is very simple to interface. Simply download this file and this file
Next, in the includes section of your .cpp file type #include "dispBoB.h"
All of the constructor/function definitions can be found here.
1 - Simple Clock¶
#include "mbed.h"
#include "dispBoB.h"
dispBoB db(p28, p27, p26); //instantiate dispBoB object
int main() {
/****UNIX TIMESTAMP STUFF****/
set_time(1309776930); //set UNIX timestamp - it's Mon, 04 Jul 2011 10:55:30 GMT where I am
while(1){ //loop forever
time_t rawtime = time(NULL); //update to instantaneous time
char buffer[32]; //create a local char array object called buffer
strftime(buffer, 32, "%H.%M.%S\n", localtime(&rawtime)); //store string formated time, suitable for dispBoB to buffer
/****dispBoB STUFF****/
db.locate(0); //position cursor to initial position
db.printf("%s", buffer); //print buffer to dispBoB
}
}
The current UNIX timestamp can be found here.

2 - Counter¶
This next small project demonstrates how the mbed can be interfaced with a small laser to create a counter, which increments every time the beam is broken. The digital input is connected to pin 12 of the mbed and requires a pull-up resistor, which can be activated from within the mebd itself
#include "mbed.h"
#include "dispBoB.h"
dispBoB db(p28, p27, p26); //instantiate a dispBoB object
InterruptIn laser(p12); //set up the laser as an external interrupt
int counter = 0; //set the counter object to zero
void count(){ //function to call upon breaking of beam
counter++; //increment counter object
db.locate(0);
db.printf("%06d", counter); //send counter info to dispBoB and display
}
int main() {
laser.mode(PullUp); //activate internal pull up
db.cls(); //clear screen
laser.rise(&count); //attach count() to interrupt
db.printf("%06d", counter); //display an inital count "000000"
}
Libraries¶
Additional notes¶
The following ASCII encoded characters are supported:
0123456789
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
! ' ( ) { } [ ] - _ .
Information
, is not supported