Ok, soooo i did it.
Espruino (Pico) for drawing text + Arduino (Nano) for controlling through a serial com @19200
Arduino code
[#include](https://forum.espruino.com/search/?q=%23include) <FlipDot_5x7.h>
[#define](https://forum.espruino.com/search/?q=%23define) CLOCK 13
[#define](https://forum.espruino.com/search/?q=%23define) DATA 11
[#define](https://forum.espruino.com/search/?q=%23define) LATCH 10
int dataReceived = 0;
/*
Wiring:
OUT Not connected to Arduino
5V 5V
LAT LATCH
GND GND
SCL CLOCK
SDA DATA
GND GND
12V VIN
12V VIN
Change false to true if the color is inverted.
*/
FlipDot_5x7 flipdot(1, 1, false);
int liste[35];
boolean flag = false;
int nItem = 0;
int temp;
void setup() {
// serial vers sepruino
Serial.begin(19200);
delay(100);
// to initiate serial
Serial.print("");
//
flipdot.begin(DATA, CLOCK, LATCH);
flipdot.fillScreen(FLIPDOT_YELLOW);
flipdot.display();
delay(1000);
flipdot.fillScreen(FLIPDOT_BLACK);
flipdot.display();
// to begin data sending
Serial.write("@");
}
void loop() {
delay(10);
}
void ecrit() {
// draw dot by dot
for (int i = 0; i < 35; i++) {
flipdot.drawPixel(i%5, int(i/5)%7, int(liste[i]));
}
// show on display
flipdot.display();
flag = false;
// empty array
liste[35];
}
void serialEvent() {
// for debugging purpose
temp += Serial.available();
while (Serial.available() > 0 && !flag) {
dataReceived = byte(Serial.read());
if (dataReceived == 0x3E) { // if endMark
Serial.flush();
// for debugging purpose
/*Serial.print("n bytes recus: ");
Serial.println(temp);
for (int i=0; i<35; i++) {
Serial.print(liste[i]);
}
Serial.println("");*/
nItem = 0;
temp = 0;
flag = true;
// show on display
ecrit();
} else {
// invert color
if (dataReceived==0) {dataReceived=1;} else {dataReceived=0;}
// fill the array with datas
liste[nItem] = dataReceived;
nItem++;
}
}
}
Espruino code
var compteur = 0;
var g;
var longT;
var texte = "The wind was rising, the wind was falling, lifting up her ugly wool skirt.";
Graphics.prototype.print = function() {
for (var y=0;y<this.getHeight();y++)
console.log(new Uint8Array(this.buffer,this.getWidth()*y,this.getWidth()).toString());
};
function sendDatas() {
if (compteur < -longT) {
compteur = 7;
console.log("reset compteur: ",compteur);
}
g = Graphics.createArrayBuffer(5,7,8);
g.setFont4x6();
g.setBgColor(1);
g.setColor(1);
g.drawString(texte,compteur,-1);
var datas = new Uint8Array(g.buffer);
if (compteur === 0) {
longT = g.stringWidth(texte);
console.log(compteur, longT);
}
Serial1.write(datas);
Serial1.print('>');
//g.print();
LED1.toggle();
compteur--;
}
function onInit() {
require("Font4x6").add(Graphics);
Serial1.setup(19200, {tx:B6,rx:B7});
// wainting for init of serial com from arduino before to send datas
Serial1.on('data', function(e) {
console.log("serial In:", e);
if (e == '@') {
setInterval(sendDatas, 100);
Serial1.removeAllListeners();
}
});
USB.setConsole();
}
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.
Ok, soooo i did it.
Espruino (Pico) for drawing text + Arduino (Nano) for controlling through a serial com @19200
Arduino code
Espruino code
a video of the display in action
https://www.instagram.com/p/BeeN2OCAVyw/
ps: i've fried 5 dots, therefor i've removed the dots on the display (upper line)