104 lines
2.4 KiB
C++
104 lines
2.4 KiB
C++
#include <Arduino.h>
|
|
|
|
#include "flipdot.h"
|
|
|
|
|
|
Flipdot flipdot;
|
|
|
|
|
|
|
|
unsigned long loopmillis=0;
|
|
unsigned long last_update=0;
|
|
|
|
#define UPDATE_INTERVAL 10
|
|
|
|
void setup() {
|
|
flipdot.init();
|
|
|
|
Serial.begin(115200);
|
|
}
|
|
|
|
int countz=0;
|
|
|
|
|
|
void loop() {
|
|
loopmillis = millis();
|
|
|
|
|
|
|
|
static bool init=false;
|
|
if (!init) {
|
|
delay(2000);
|
|
flipdot.row=0;
|
|
Serial.println("Clearing Display");
|
|
for (int l=0;l<25;l++) {
|
|
flipdot.selectColumnClear(l%25);
|
|
|
|
flipdot.shiftData();
|
|
|
|
if (!flipdot.clearSelectedColumn()) {
|
|
Serial.println("Error clearing column!");
|
|
}else{
|
|
Serial.println("Cleared");
|
|
}
|
|
|
|
delay(10);
|
|
}
|
|
init=true;
|
|
delay(1000);
|
|
}
|
|
|
|
|
|
if (loopmillis > last_update + UPDATE_INTERVAL)
|
|
{
|
|
|
|
Serial.print("count=");
|
|
Serial.print(countz);Serial.print(": ");
|
|
|
|
//setting colX to 128, 32, 8,2 (or a combination of), then appling 12V to driver and GND to Clear, clears these colums
|
|
// this applies +12v to selected columns
|
|
//setting colX to 64,16,4,1 (or a combination of), then setting row shift registers to some setting sets the selected dots
|
|
// this applies GND to selected columns
|
|
//reset pin on annax board input should be used (not pulled to gnd for a short time) after dots have been flipped (to disable potentially activated transistors)
|
|
|
|
|
|
//cycle testing set dots
|
|
flipdot.selectColumnSet(countz/16); //lower column number is on the left
|
|
flipdot.row=pow(2, (countz)%16);//low significant bits are lower rows (when connector at top)
|
|
|
|
|
|
|
|
|
|
/*Serial.print("Row="); Serial.print(row); Serial.print(" Col=");
|
|
for (uint8_t i=0;i<7;i++) {
|
|
Serial.print(","); Serial.print(col[i]);
|
|
}
|
|
Serial.println();*/
|
|
//reset pin on ribbon cable high (12Vpullup/open), then low (via Transistor)
|
|
|
|
unsigned long starttime=micros();
|
|
|
|
flipdot.shiftData();
|
|
|
|
|
|
flipdot.setSelectedDot();
|
|
|
|
unsigned long shiftduration=micros()-starttime;
|
|
Serial.println("");
|
|
Serial.print("Duration="); Serial.println(shiftduration);
|
|
|
|
|
|
|
|
last_update=loopmillis;
|
|
countz++;
|
|
|
|
if (countz>=16*25) {
|
|
countz=0;
|
|
init=false;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|