Pulled some TBC20-12/... from junk - bi-color green/red and orange 5x7 LED modules... and I did - for testing them before investing more work - drive them directly with PICO... When both LEDs are on, the color is an orange. Attached you find some clips and pictures.
Below you find the code - which goes through each individual LED with given color. In console I then entered instant setInterval to indefinitely scroll through the colors while the display goes through all LEDs, one by one.
// TBC20-12-test5.js
// 5x7 red, green and orange dot display w/ common cathode (bi-color)
// http://www.kingbrightusa.com/images/catalog/SPEC/TBC20-12EGWA.pdf
// cycle to all dots in selected color
//
// NOTE: use auto pinMode!
//
// --- Wiring:
// Row R1..R7 Anodes - common, for all AND green and red rows
// Col gC1..gC5 and rC1..rC5 green and rED Cathodes - ten (10)
// GPIOs Espruibo PICO A# and B#
//
// 4 5 6 7 8 9 10 11 12 (13)
// B3 B4 B5 B6 B7 A8 B8 B9 A10 (A0)
// | | | | | | | | | - direct connetion
// 18 17 16 15 14 13 12 11 10 watch alignment
// rC1 R3 R1 R2 R4 gC3 gC4 rC5 gC5
//
//
// gC1 gC2 rC2 rC3 R6 R7 rC4 R5 NC?
// 1 2 3 4 5 6 7 8 9 watch alignment
// : : : : : : : : : - wired from 'above'
// B13 B10 B1 A7 A6 A5 A4 A3 A2 (A1)
// 23 22 21 20 19 18 17 16 15 (1$)
// --- Row / Col pin assignments (according to wiring, see picture)
//
// R1 R2 R3 R4 R5 R6 R7
var rps=[ B5, B6, B4, B7, A3, A6, A5]; // row pins - R1..R7
//
// rC1 rC2 rC3 rC4 rC5 gC1 gC2 gC3 gC4 gC5
var cps=[ B3, B1, A7, A4, B9,B13,B10, A8, B8,A10]; // col pins (r, g)
// --- Hauskeeping
var rMax=6; // Row maximum 0..6
var cMax=4; // Col maximum 0..4
var rpOn, cpOn; // previus row/col pin(s) on for switching off in next cycle
var r=rMax, c=cMax; // row/col last - but not on - to start with first
// --- Rum parameters - speed and color
// can be change in console while running
var t0=100; // default and previous cycle time (see below)
var t=t0; // cycle time (>0) - cycle invokes itself after t [ms]
var color=1; // Color 1=red, 2=green, 3=orange (red and green at same time)
// core function: cycle:
// - switch old of, increment and switch new on - col as well as row
// - row concitional on column start over
function cycle() {
if (cpOn) digitalRead(cpOn); // 'switch' off (by making it/them input)
if (++c>cMax) { // start over w/ col 0
c=0;
if (rpOn) digitalRead(rpOn); // 'switch off' (by making it/them input)
if (++r>rMax) { // start over w/ row 0
r=0;
}
rpOn=rps[r]; // row pin
digitalWrite(rpOn,1); // pull anode up
}
cpOn // col pin(s) // select col pin(s) for color case:
= (color==3) ? [cps[c],cps[c+5]] // both red and green creating orange
: (color==2) ? cps[c+5] // green
: cps[c] // red (default)
;
digitalWrite(cpOn,0); // pull cathode(s) down
if (t>0) {
setTimeout(cycle,t);
} else {
if (cpOn) digitalRead(cpOn); // 'switch' off (by making it/them input)
if (rpOn) digitalRead(rpOn); // 'switch off' (by making it/them input)
}
}
function h() { // halt
t0=t;
t=0;
}
function resume() { // resume / run
t=t0;
cycle();
}
function onInit() {
cycle(); // auto start cycle onInit
}
setTimeout(onInit,500); // auto onInit while developing
The first shot is taken with flash: you can barely see green in 6th row and 1st column on. I could increase the supply (Anode) voltage to 5 Volt, for example, but that would already require some driver... even if it is just a buffer... or level shifter. Second shot is taken with normal light and color can be seen better... of course, it is also red, which is easy to detect. Last shot is interesting: because taken in low light, the shutter picked up an outgoing and an incoming LED... ;O
Putting multiples of these 5x7 LED modules into a panel requires lots of losts of lots of wiring... therefore, the post about running text out of an Espruino Graphics buffer will come a bit later.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
a next step...
Pulled some TBC20-12/... from junk - bi-color green/red and orange 5x7 LED modules... and I did - for testing them before investing more work - drive them directly with PICO... When both LEDs are on, the color is an orange. Attached you find some clips and pictures.
Below you find the code - which goes through each individual LED with given color. In console I then entered instant setInterval to indefinitely scroll through the colors while the display goes through all LEDs, one by one.
The first shot is taken with flash: you can barely see green in 6th row and 1st column on. I could increase the supply (Anode) voltage to 5 Volt, for example, but that would already require some driver... even if it is just a buffer... or level shifter. Second shot is taken with normal light and color can be seen better... of course, it is also red, which is easy to detect. Last shot is interesting: because taken in low light, the shutter picked up an outgoing and an incoming LED... ;O
Putting multiples of these 5x7 LED modules into a panel requires lots of losts of lots of wiring... therefore, the post about running text out of an Espruino Graphics buffer will come a bit later.
5 Attachments