-
-
well i've got the prob with my new pico (thx @Gordon, they arrived today). i've tried the
Storage.getFree()
but i've got an errorUncaught ReferenceError: "Storage" is not defined at line 5 col 22 console.log(Storage.getFree());
i've tried before without the console.log and received same error
-
well well well i do not understand the issue. I'm confuse.
i've retried the code on the Max7219 with no encoding accents.. it works fine (few day ago it dont)
if IDE does not find the font (require), it does not find the module too(require), i have no local repo...
i do not understand why sometime i have to encode, and not today!sorry for this post.
in fact it works fine.
i'm not able to reproduce my prob... who does not seem to be...
sorry -
-
-
Hello Markus,
yes that's right (i think i've found a way post#1, i did not tried it with the Max7219 module), BUT
the need to encode accents (ascii > 127) depends the way we use drawString on espruino.
It's a bit annoying...
Is there a way, to homogenize the way it works, with or without a graphicArrayBuffer? (i'm always use the example provided with modules)therefore it looks like more a wish list, than a real problem.
Ok it's a problem only for non english people that use ascii over 127 ;)regards
é.
-
i answer myself
if i don't use my string.replace it look good (with accents)
it seems it's a pb with module.
currently i work with TM1640 Module
last week i was working with Max7219
with the max's Module i use an arrayBufferSPI2.setup({mosi:B15, sck:B13}); var disp = require("MAX7219").connect(SPI2, B14); var g = Graphics.createArrayBuffer(8,8,1); // Create graphics g.flip = function() { disp.raw(g.buffer); }; // To send to the display g.drawString("Mémé"); g.flip(); // update what's on the display
with the arrayBuffer, accents must be encoded.
But with the TM1640 Module, we drawString directly in the display
var g = require("TM1640").connect({din: NodeMCU.D7, clk: NodeMCU.D5}, function() { g.drawString("Mémé"); g.setContrast(2); // a value between `0` lowest and `7` highest intensity. g.flip(); });
is it the cause of the encoding pb?
regards
-
Hello,
it should be a newb question... sorry.
i'm working with a 8x8 led matrix
I'm working with string with extented latin chars (éèêàâî,,,).
to draw the string on the display with accents we have to convert accents with char hexa value."mémé"
become
"m\xe9m\xe9"
i'm a lazy guy and decide to convert the sentence when it's sent to matrix.
i use this code;phrase = phrase.replace(/[^\x00-\x7F]/g, function(m) { return "\\x" + m.charCodeAt(0).toString(16); });
it's look as it have to look, but the string is sent as is and i saw on the display "m\xe9m\xe9" and not "mémé" as it should.
What i'have missed?regards
-
So the problem persist, time to time... I suppose spi is asynchronous...
Therfore I've added a reboot() at the end of each cycle (all text done and led cycle done)
The spi is reinitialized and every thing look good. And there is no messe on the display.
I suppose i can do in an other way by adding more time to the first line, it seems, it's at a restart (when substring displayed (my cursor) go back to beginning) which the prob issue.Thanks for your help.
-
@allObjects why do you think it is a transcription from another langage?
I use example provided in the max7219's module. And build in js. I iterate code writing step by step so the structure is durty (i'm pretty sure there is useless var)
Yes i'm not dev, just designer, and therfore i'm not thinking as a dev. ;)I've rewrote with a setTimeout.
If i well anderstand, there is no parallel process and instructions are worked one by one. Therefore if i restart a function at the end of the same function,it will restart after everythink is done. No?
Except if spi transfer is asynchronous. Is it? -
Hello @allObjects,
thanks for your advice.
the first timer (sendDatas) need between 18 and 20 ms to achieve.
i rewrote the code with only one timer and a trigger (a seesaw).
each time it play led, one in two it send datas to display.
the timer is banging at 30ms (so under the sendDatas() needs)
I've started a test. -
-
Hello, i'm working with a cheap chinese 8x8 led matrix mounted with a Max7219.
sometime ( i'm enable to determine when or why, can't reproduce bug). the display go weird... it show only one line or 2 lines of pix... after a time it come back good.
if i unplug/replug the board (a pico) everything restart well.
in first i was thinking about a prob with the graphic buffer but when i ask to show content it look full of datas...
therfore i was thinking a prob with the display...is it possible to reduce the spi baudrate and in wich value?
or to reset an spi connection?
do i need to find an other matrix with better chip... an idea?ps: i'm testing with low data transfer to display and it seem to work well (show on display one time on 10)
i'have a second timer with a led pulse...regards
require("Font4x6").add(Graphics); // spi mosi=DIN, sck=CLOCK SPI2.setup({mosi:B15, sck:B13}); // crée le buffer graphique 8x8 en 1 bit var g = Graphics.createArrayBuffer(8,8,1); // connecte en spi var disp = require("MAX7219").connect(SPI2, B14); var texte = "Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent commodo cursus magna, vel scelerisque nisl consectetur et."; var phrase = texte.substr(0,12); var sDerCar = phrase.substr(10,2); var cPhrase = 0; var compteur = 8; var longT = 0; var lengthT = texte.length; var longP = 0; var decalage = 0; var debut = false; var val=0; var step = 5; function sendData() { // raccorde le bout de ligne suivant if (compteur < -longP+decalage+1){ if (debut) {compteur = 8; debut=false;console.log("debut");} else {compteur = 0;} cPhrase++; // si au bout du texte phrase= texte.substr(cPhrase*10,12); sDerCar = phrase.substr(10,2); decalage = g.stringWidth(sDerCar); console.log("decalage:",decalage); if (decalage === 0) { // on est en fin de texte, à la prochaine boucle, on reprend le texte au début cPhrase=-1; debut = true; console.log("redemarrage texte"); } } // reset le buffer, ajoute la font, ecrit la chaine de caractères g = Graphics.createArrayBuffer(8,8,1); g.setFont4x6(); /* une fois font utilisée, on connait la longueur de la chaine*/ longP = g.stringWidth(phrase); // calcul le decalage (en pix) entre chaque bout de phrase decalage = g.stringWidth(sDerCar); g.drawString(phrase,compteur,0); // envoie à la matrice disp.intensity(0.2); disp.raw(g.buffer); compteur--; } function led() { /* var val= Math.random(); if (val<.5) {val = 0;}*/ //console.log(val); calc = Math.sin(val/100); analogWrite(A5, Math.abs(calc),{freq:300}); val+=step; if (val>314) {val = 0; step=(Math.random()*8)+1;} } function onInit() { console.log("init programme - éric choisy ©2018"); setInterval(sendData, 60); setInterval(led, 10); }
-
Gorgeous!
Bravo @allObjects.
Thanks so much for your work.Have you try to chain 2 flip dot display?
How to screen something on one display and follow on the second one?
In the arduino's lib, it seems possible.
On the hannio github, there is a schematic to chain two flipdot. -
-
Ok, soooo i did it.
Espruino (Pico) for drawing text + Arduino (Nano) for controlling through a serial com @19200Arduino code
[#include](http://forum.espruino.com/search/?q=%23include) <FlipDot_5x7.h> [#define](http://forum.espruino.com/search/?q=%23define) CLOCK 13 [#define](http://forum.espruino.com/search/?q=%23define) DATA 11 [#define](http://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(); }
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)
-
-
-
Hello,
As i enable to control the flipdot hannio' display ( see forum) with an espruino.
I'm trying to communicate to an arduino which control the display.
Spi and i2c are in use in the arduino so i do with serial. It's not really good (i suppose i'm trying comm to fast) but i'm able iniate a com between the boards...
I'm able to transfer array, but at the moment, not the arrayBuffer.Regards
-
Hye, Gordon
I need of a byte array (0,1) (pixel OFF, pixel ON) row by raw.
the matrix is on/off not in 8bits.
or i do not understand what is an arrayBuffer...in your example it is suppose to do that (it's exactly what i need to transfer to my display via serial):
//0,0,0,0,0,0,0,0 //0,1,1,0,0,0,1,1 //0,1,1,0,0,0,1,1 //0,0,1,1,0,1,1,0 //0,0,0,1,1,1,0,0 //0,0,1,1,0,1,1,0 //0,1,1,0,0,0,1,1 //0,1,1,0,0,0,1,1
it does not... why?
-
Hello,
i'm trying to work with arrayBuffer but i'm bad...
I'm using exemple in the graphics library at Internal Userequire("Font4x7").add(Graphics); var g = Graphics.createArrayBuffer(5,7,1, {zigzag:true}); g.setFont4x7(); g.drawString("hello",compteur,0);
Graphics.prototype.print = function() { for (var y=0;y<this.getHeight();y++) console.log(new Uint8Array(this.buffer,this.getWidth()*y,this.getWidth())); };
when i use the
g.print()
it does not produce an array of 0 and 1...
but that...new Uint8Array([112, 240, 199, 7, 4]) new Uint8Array(5) new Uint8Array(5) new Uint8Array(5) new Uint8Array(5) new Uint8Array(5) new Uint8Array(5)
i would like to send via Serial an array of row and colum as in the exemple of
print()
thanks for you help
-
I'm back on subject with some news and questions.
I've tested @allObjects's code. I've got strange behavior of the picoboard: pb to upload code, have to unplug+plug to handle the board.
with a simple loop to flip one pix at a time, i've got the same behavior than with my previous code. Some dot flips in random order...
I have retest some code with an arduino, and it work very accurately.
My question is about logic level (3.3v vs 5.5v) with shift register et encoders... is it possible that the strnage behavior is due to this shifting?
I've bought online this night a shift level breakoutboard.
I will retried with it at the end of the week.
so wait and see.@allObjects: You use
A0
pin for the latch (nssPin) do i need an Analog Pin? On the pico board, the size of this pin is smaller (difficult to clip or solder), therefor i use an other pin. is it a pb?
You've writtenInit your 3 pins - data, sclk, rclk - as output and set rclk high and you are just fine from the get go.
Do i need to explicitly use
pinMode(xx, 'output')
? and anopenDrain
argument for the nssPin?
Thanks for your time.regards
-
-
it's a setinterval..... it loop
I'm working with espruino mini unpinned.I think i have alway the same prob with the way to powering circuit (leds + espruino)if i need more than 400mA and using usb for programming at the same time... i need lot of power for the leds...
I'm confuse because usb power the board!
how to connect heavy power during developping time with usb plugged? and have same power without usb connected...
On my previous work i do not need power and using for powering oled screen... we've (you in fact) find the solution.
I'm confuse... always and always... sorry... when i've read your tech doc about powering, i'm confuse... for a non english reader, i find your explanation to ambigious (i'm sorry to have to say that...), the way you build your sentence is not univoc (one way) for my understanding level.
so i'm confuse and i don't know if i had to do that way or this way... do i have to bridge some thing on the back of the board????
I've roasted, one board... i was desesperate to do that and i want to avoid to do that again, just because i'm enable to understand how to wiring power on the espruino...Can i power the espruino's board and my leds by the same way
Vin -> 5V and vBat -> Leds?I think it's a power prob.... and perhaps a logic level prob... but...
regards
é.
Hello, i'm playing with led matrix.
I've bought some small 5x7 matrix and want to display some char on it with the espruino pico
i do not use any hardware driver because i just need 12pins to solder on the board with small resistor to limit current... i did it on an arduino (with a different display but the same pb)
I would like to use the powerfull of js to generate text.
On the Arduino i've used a lib (sevensegment) to declare pin as cathode and anode to drive the display.
Is there something similar to declare a list of pins to connect to a graphicArray? (hope i'm understandable)
best regards
éric