-
-
Hello,
i'm playing with self soldered ws2812 strip (neopixel like from ebay)
i've use the solution with the open drain (330ohm between DIN and 5v) - color have changed
but i've got strange behavior.
I'm working with pattern repeated on the strip...
if i switchOn only on led on my pattern , there is two led ligthed up one purple, one green...
i've tried some things like decay rbg value in the rgb array, but it's not that...
any idea...
Where i'm bad?
thanks for your idea...é.
var tGauss = new Uint8ClampedArray(9); var rgb = new Uint8ClampedArray(20*3); tGauss = [0,0,0,0,255,0,0,0,0]; console.log(rgb); // animation chenillard function anime() { // pour espruino for (var i = 0; i < Math.ceil(rgb.length/3); i++) { rgb[(i*3)+0] = tGauss[i%tGauss.length]; rgb[(i*3)+1] = tGauss[i%tGauss.length]; rgb[(i*3)+2] = tGauss[i%tGauss.length]; console.log(rgb[(i*3)],rgb[(i*3)+1],rgb[(i*3)+2]); } require("neopixel").write(B15, rgb ); decalage++; } function onInit() { USB.setConsole(); pinMode(B15, 'af_opendrain'); setInterval( anime, 500); }
-
@allObjects: Whao, i'm impressed! Amazing!
Have to take time to test your code.
Thanks for the great explanation.
I've got the version with the silkscreen error on pcb (inverted LAT and 5V pins).
Sorry i just understand the use of espruino spi.write() - data,clk, latch pins@Gordon, sorry, i've forgotted to write: i use a pico board unpinned.
The arduino lib is great but for english writer, no accents! :/
Want to combine with the custom font of espruino. -
-
There is 2 ic 74hc238 who are decoding a 3bit adress and convert to 8bits for the shift register 74hc595 (i suppose) for l293d
I do not have direct access to shift register.
But perhaps i'm wrong on the way that's works.
Or in a different way.
The 595 is a stronger version of standard shift register...Here the git page of the project (lib and diagramm)
In the arduino lib, the latch time is 500 microseconds.
I've tried with more time but no better results...An other question who is alway confuse me on the espruino.
I want to use the usb for debugging purpose,
The display is powered in 12v and convert a line to 5v to power the mcu.
i need to power the espruino from this line.
On which pin do i need to clip the power (i'm not soldering at the moment)
On the pin near the gnd one or the next pin (third) or on the ViN pin?
I'm sad cause i've burned two display with an incorrect power connection when changing clip position from the mcu.
Regards -
Hello @Gordon
I've bought a flipdot display controled by a shift register.
There is an arduino lib to control it...
i find the code to display one pixel with arduino:void FlipDot_5x7::displayPixel(int16_t x, int16_t y, boolean color) { if (x < FLIPDOT_MODULE_WIDTH && y < FLIPDOT_MODULE_HEIGHT) { // DR R0 R1 R2 DC C0 C1 C2 uint8_t data = color != _invert; data |= y << 1; data |= (color == _invert) << 4; data |= x << 5; shiftOut(_data, _clock, LSBFIRST, data); } }
it needs a LATCH pin more for working, i've added it in the js code
i've rewrited the code for espruino like thisvar DATA_PIN = A8; var CLOCK_PIN = B6; var LATCH_PIN = B4; var compteur=0; var aff= 0; var FLIPDOT_MODULE_WIDTH = 5; var FLIPDOT_MODULE_HEIGHT = 7; var _invert = false; function displayPixel(x, y, color) { if (x < FLIPDOT_MODULE_WIDTH && y < FLIPDOT_MODULE_HEIGHT) { // DR R0 R1 R2 DC C0 C1 C2 var data = color != _invert; data |= y << 1; data |= (color == _invert) << 4; data |= x << 5; shiftOut(DATA_PIN, {clk:CLOCK_PIN}, data); //console.log("data:", data.toString(2)); } console.log("x,y,c:",x,y,color); } function onInit() { setInterval(function() { digitalPulse(LATCH_PIN,1,1); displayPixel(aff%5, Math.floor(aff/5)%7, compteur%2); LED1.toggle(); compteur ++; if (compteur%2 ===0) {aff++;} }, 500); }
it does not work...
if i generate a random number for datadata = Math.round(Math.random()*255);
dots flip sometime...
i suppose it's about format of my byte...Luca from Hannio send me the format for the byte
the data has to be xxxCyyyc where xxx is the binary representation of
the x coord (and yyy for the y). c is the color, C is the inverted
value. Thus, for example, x = 2, y = 3, c = 1 would be 010 0 011 1.Where i'm wrong?
best regards
é.
-
-
-
@Gordon oups, you're rigth.
It's a bad cut/past.
I've modifying the code
Thanks -
I've done this...
i'm waiting the postman with the 7x1 display for testing... (monday or later)g = Graphics.createArrayBuffer(8,8,1); g.setFont4x6(); g.drawString(texte,compteur,0); a = new Uint8Array(g.buffer); // ecran 1x7 Serial1.write([0x80,0x89,Adress],a[0],[0x8F]); // ecran 7x7 Serial1.write([0x80,0x87,Adress2],a[1],a[2],a[3],a[4],a[5],a[6],a[7],[0x8F]);
-
Hello,
i'm a bit newb with arrayBuffer...
i use a flipdot display compose with 1 line of 7 points and a block of 7 lines of 7 points.
I need an array of 8x8 todrawString(t,x,y)
var g = Graphics.createArrayBuffer(8,8,1);
How to access of the data stored in the first line of the array?
g[0]
?
and the rest of the buffer?sorry for this basic question but i don't know how to use this object.
-
The crash is not an espruino issue, it's an usb issue, it produce too sometime with arduino...
Last week i have to update firmware and install my code on 8 Picos.... I've got crashs (with automatic reboot and message) 4 time 😗. For simple and repetitive task, reboot had made it long and stressfull.For the upload problem, i don't know, i've discovered the
reset()
instruction and it seems to resolve the problem (when code use shortsetInterval()
). You're probably right, i just change my process for upload with in first step, areset()
. Have to check -
An other issue with the standart 1v92 firmware.
with the quicksetInterval()
orserial1.write()
i'm unable to upload code... upload stall at a point (variable). Have to unplug and plug pico board (1.4b) in bootloader mode and reinstall firmware.with your custom firmware it always upload to board
huge update for me : plug/unplug usb board crash my old macbook Pro (17 mid 2009) -> 1 time/4 unplug :/thanks
é.
-
timing test
t = getTime(); g.setFontDennis8(); g.drawString(texte,compteur,0); console.log("Draw took ",getTime()-t);
1v92 FIRMWARE
with custom font likesetFontDennis8
: 0,244
with custom font simplified : 0,239
with custom font likesetFontDennis8
+E.toString()
: 0,154
with custom font simplifed +E.toString()
: 0,1551v92 CUSTOM FIRMWARE
with custom font likesetFontDennis8
: 0,106
with custom font simplified : 0,106
with custom font likesetFontDennis8
+E.toString(atob)
+ : 0,094
with custom font simplified +E.toString()
: 0,094therefor best result with:
. custom firmware
.E.toString()
. nothing more with simplified font (only usefull char design) -
and yes @Gordon, it's a long text and it is exactly why i work with Espruino,
. more ram
. a better api for string manipulation (than arduino) = js,
. a small form factor!
. easy to program:)
-
@Gordon, with that code there is a slowing down of the frame rate with/without the
setFontDennis8()
(the time i've gave you, was resulting of the code above with commented or not the font call...) just that...
Using custom font is 10 time slower.. why?how to reduce the delay?
if i reduce the design of char (if i remove unused char design with white pixels...)will it be less time consuming for setting the font?in other way why your custom font is quicker use than an external font?
Is it because the font is smaller (4x3 or 5x4)?
is it possible to produce a custom firmware with a custom font embeded with accent (yes i'm french and i use accents like many other non-english writers :) )regards
var TX_ENABLE_PIN = A8; var TX_PIN = B6; var compteur=0; var longT = 0; var g = Graphics.createArrayBuffer(8,7,1); var texte = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pellentesque dui at leo consectetur, finibus tempor tellus sollicitudin. Maecenas dignissim est sem, feugiat mollis sem aliquet a. Sed nunc ex, faucibus dapibus tortor et, dignissim tincidunt nisl. Nulla facilisi. Maecenas nunc nunc, interdum eu vulputate id, laoreet a lacus. Sed et felis dapibus sapien porta euismod vel ut mi. Etiam at augue vel quam dictum sodales a et purus. Donec ac erat posuere, maximus erat sit amet, facilisis lacus. Aenean dictum, sem et dignissim sagittis, eros velit ultrices purus, nec lobortis risus elit sed lectus. Maecenas tincidunt convallis mauris sit amet scelerisque. Suspendisse et lorem sit amet ligula dignissim feugiat. Maecenas tincidunt, eros non ultricies tincidunt, risus magna laoreet urna, in ultrices mi ipsum eget metus. Nam mollis ultricies fermentum. Fusce ac molestie mi, non suscipit quam. Nunc sit amet facilisis diam. Donec erat tellus, pellentesque vitae erat eget, viverra rutrum ex. Proin rhoncus nisl quam, a sodales nibh vulputate molestie. Proin at ex dolor. Cras turpis lacus, volutpat ut purus et, volutpat luctus massa. Mauris vel diam vestibulum, gravida risus sit amet, tristique ante. Mauris imperdiet lobortis arcu, in sollicitudin sem malesuada at. Donec volutpat justo quam, non viverra nulla ultrices quis. Duis luctus, turpis nec faucibus consequat, augue sapien consectetur ex, sit amet rhoncus ante purus in purus. In tristique dui nisl, ac fermentum turpis dictum et. Cras eu rutrum neque. Donec tempus tincidunt justo, quis elementum ex cursus eu. In lobortis, velit at tempor fringilla, ante risus feugiat dolor, eget eleifend nulla nibh eu urna. Nam quis sodales tortor, vitae convallis nisl. Suspendisse at accumsan ipsum, vel semper sapien. Sed sit amet sem dignissim, ultricies justo eget, euismod metus. Donec condimentum molestie velit, a sagittis turpis luctus vitae. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis id fermentum neque. Fusce euismod tristique urna at molestie. Maecenas eget facilisis magna, et euismod tellus. Nulla lacus nulla, cursus gravida libero vel, ultrices pharetra lacus. Vivamus sagittis ante leo, sed ultrices purus vestibulum at. Fusce aliquam blandit arcu, nec sodales diam interdum vel. Phasellus eget felis vitae elit vehicula porta ut eu sapien. Morbi congue eu dui vel posuere. Quisque sit amet mattis diam, porttitor porta nibh. Etiam id dictum ligula, a viverra fusce."; function sendData() { if (longT === 0) { longT = g.stringWidth(texte); console.log(longT); } if (compteur < -longT) compteur = 7; g = Graphics.createArrayBuffer(8,7,1); t = getTime(); g.setFontDennis8(); g.drawString(texte,compteur,0); console.log("Draw took ",getTime()-t); LED1.toggle(); digitalPulse(TX_ENABLE_PIN,1,7); Serial1.write([0x80,0x87,0xFF],g.buffer,[0x8F]); compteur--; } function onInit() { require("FontDennis8").add(Graphics); g.setFontDennis8(); Serial1.setup(19200,{tx:TX_PIN}); setInterval(sendData, 70); }
ps: i define only one time (in this code) the
stringWidth()
;) thxs for the advice.ps:2 with shorter text, it's quicker but not that much.
-
-
var TX_ENABLE_PIN = A8; var TX_PIN = B6; var compteur=0; var balance = 1; var g = Graphics.createArrayBuffer(8,7,1); var texte = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed pellentesque dui at leo consectetur, finibus tempor tellus sollicitudin. Maecenas dignissim est sem, feugiat mollis sem aliquet a. Sed nunc ex, faucibus dapibus tortor et, dignissim tincidunt nisl. Nulla facilisi. Maecenas nunc nunc, interdum eu vulputate id, laoreet a lacus. Sed et felis dapibus sapien porta euismod vel ut mi. Etiam at augue vel quam dictum sodales a et purus. Donec ac erat posuere, maximus erat sit amet, facilisis lacus. Aenean dictum, sem et dignissim sagittis, eros velit ultrices purus, nec lobortis risus elit sed lectus. Maecenas tincidunt convallis mauris sit amet scelerisque. Suspendisse et lorem sit amet ligula dignissim feugiat. Maecenas tincidunt, eros non ultricies tincidunt, risus magna laoreet urna, in ultrices mi ipsum eget metus. Nam mollis ultricies fermentum. Fusce ac molestie mi, non suscipit quam. Nunc sit amet facilisis diam. Donec erat tellus, pellentesque vitae erat eget, viverra rutrum ex. Proin rhoncus nisl quam, a sodales nibh vulputate molestie. Proin at ex dolor. Cras turpis lacus, volutpat ut purus et, volutpat luctus massa. Mauris vel diam vestibulum, gravida risus sit amet, tristique ante. Mauris imperdiet lobortis arcu, in sollicitudin sem malesuada at. Donec volutpat justo quam, non viverra nulla ultrices quis. Duis luctus, turpis nec faucibus consequat, augue sapien consectetur ex, sit amet rhoncus ante purus in purus. In tristique dui nisl, ac fermentum turpis dictum et. Cras eu rutrum neque. Donec tempus tincidunt justo, quis elementum ex cursus eu. In lobortis, velit at tempor fringilla, ante risus feugiat dolor, eget eleifend nulla nibh eu urna. Nam quis sodales tortor, vitae convallis nisl. Suspendisse at accumsan ipsum, vel semper sapien. Sed sit amet sem dignissim, ultricies justo eget, euismod metus. Donec condimentum molestie velit, a sagittis turpis luctus vitae. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis id fermentum neque. Fusce euismod tristique urna at molestie. Maecenas eget facilisis magna, et euismod tellus. Nulla lacus nulla, cursus gravida libero vel, ultrices pharetra lacus. Vivamus sagittis ante leo, sed ultrices purus vestibulum at. Fusce aliquam blandit arcu, nec sodales diam interdum vel. Phasellus eget felis vitae elit vehicula porta ut eu sapien. Morbi congue eu dui vel posuere. Quisque sit amet mattis diam, porttitor porta nibh. Etiam id dictum ligula, a viverra fusce."; function sendData() { if (compteur < -g.stringWidth(texte)) compteur = 7; g = Graphics.createArrayBuffer(8,7,1); //g.setFontDennis8(); g.drawString(texte,compteur,0); balance = !balance; digitalWrite(LED1, balance); digitalPulse(TX_ENABLE_PIN,1,7); Serial1.write([0x80,0x87,0xFF],g.buffer,[0x8F]); compteur--; } function onInit() { require("FontDennis8").add(Graphics); Serial1.setup(19200,{tx:TX_PIN}); setInterval(sendData, 100); }
just try this un/comment the setFontDennis8()
the blinking is slowing down...my texte var is about 2500 char long...
regards
-
hello @Gordon,
I've found the delay's responsible:g.setFontDennis8();
if i put in comment, the frame rate is good...
have you a way to keep the framerate good?
the default font is too small and with no accents.regards
-
-
Hello @Gordon
i continue to experiment with flipdot display.
i'm enable to use a higher baudrate than 9600 otherwise i'm lossing some frame.
I've tested the serial port voltage on serial1 it is around 3.3v... is it enough to use with the rs485 communication module? do i need a level shifter?second question is about setinterval sending data.
If i reduce interval there is a limit around 350 or 400 ms between each sending. can't do quicker... have you any idea about the problem? does it come from the board or from the display?thanks
-
i create a post in project category
http://forum.espruino.com/conversations/306572/ -
with the fabulous help of @Gordon
there is an example code for working with alfazeta 7x7 flipdots panel (around 80€ + shipping)/* 5 wires used on pin A8, B7, B6 + a RS485 module B6 -> DI from RS485 module B7 -> DE, RE pins A8 -> RO pin + GND + 5v */ var TX_ENABLE_PIN = A8; var TX_PIN = B6; var cpt=0; var g = Graphics.createArrayBuffer(8,7,1); var text = "I love Espruino"; function sendData() { if (cpt < -g.stringWidth(text)) cpt = 7; g = Graphics.createArrayBuffer(8,7,1); g.setFontDennis8(); g.drawString(text,cpt,0); Serial1.write([0x80,0x87,0xFF],g.buffer,[0x8F]); cpt--; } function onInit() { require("FontDennis8").add(Graphics); Serial1.setup(9600,{tx:TX_PIN}); digitalWrite(TX_ENABLE_PIN, 1); setInterval(sendData, 150); }
and a video demo of code
I've tried with only 2 leds (new wire, new soldering, new leds)
same result.