Aliexpressなどで販売されている64x32のフルカラードットマトリクスLED2枚とNucleo F401REを利用して、 E233系の駅停車時、路線名表示ありのLED側面行先表示を再現するプログラムです。 3秒間隔、3段階切替で、路線名、種別、行先、次停車駅を個別に指定することが可能です。
Dependencies: SDFileSystem mbed
Revision 3:6dbbc0130e96, committed 2014-10-19
- Comitter:
- chirashi
- Date:
- Sun Oct 19 11:16:58 2014 +0000
- Parent:
- 2:c1a9a2a0885d
- Child:
- 4:245f17936b1a
- Commit message:
- delay
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Oct 19 09:50:34 2014 +0000
+++ b/main.cpp Sun Oct 19 11:16:58 2014 +0000
@@ -110,6 +110,24 @@
LAT = LOW;
}
+void WrRowOFF(unsigned char Row)
+{
+ // Write specified row (and row+8) to display. Valid input: 0 to 7.
+ ABC = 7-Row; // Set row address
+ for(int col=0; col<32; col++) { // To daisychain more displays, I guess you would have to increase this counter to n*32 columns. Might mirror though.
+ R1 = 0; // Red bit, upper half
+ G1 = 0; // Green bit, upper half
+ B1 = 0; // Blue bit, upper half
+ R2 = 0; // Red bit, lower half
+ G2 = 0; // Green bit, lower half
+ B2 = 0; // Blue bit, lower half
+ CLK = HIGH; // tick (clock bit in)
+ CLK = LOW; // tock
+ }
+ LAT = HIGH; // Latch entire row
+ LAT = LOW;
+}
+
void Pset(unsigned char x,unsigned char y, unsigned char c)
{
// Set pixel (x,y) to color c
@@ -137,15 +155,31 @@
}
}
+
+void PaintOFF()
+{
+ // Write graphics memory to display
+ for(int Row=0; Row<8; Row++) {
+ OE = HIGH; // Disable output
+ WrRowOFF(Row);
+ OE = LOW; // Enable output
+ wait_us(500); // Wasting some time. Use for whatever else. Probably better with a ticker for the display refresh.
+ }
+}
+
+
+
int main()
{
Init(); // Set things up
while(1) { // Messy demo loop following...
CT++;
+
if((CT<=2560)||(CT>=2880 && CT<=4160)) {
Paint(); // Refresh display
if((CT % 20)==0) ShiftRight(); // After every 20 refresh, do a ShiftRight
}
+
if(CT==2560) {
for(int c=0; c<8; c++) {
for(int x=c; x<(31-c); x++) {// Top side
@@ -166,10 +200,14 @@
}
}
}
- //if CT > 4160 then
+
if(CT>4160) {
MkPattern(); // Restore original priceless artwork
CT=0; // Start all over.
}
+
+ PaintOFF();
+ wait_us(100);
}
+
}