-
-
-
Sorry it does not work
there is no callback on serial therefor you pulse on the TX_ENABLE_PIN ok.
but initiate the serial with the TX pin ...
i've tried thisvar TX_ENABLE_PIN = A8; var TX_PIN = B6; function sendData(data) { digitalPulse(TX_ENABLE_PIN,1, (data.length+1)*10/19200); Serial1.write(data); console.log("envoie data", data.toString()); } function onInit() { Serial1.setup(19200,{tx:TX_PIN}); setInterval(sendData, 2000, [0x80,0x87,0xFF,0x01,0x01,0x01,0x01,0x7F,0x7F,0x7F,0x8F]); }
is it good or i can't use serial1 with usb plugged?
-
i do not put it online, for share (i'm lazy guy), i give it here...
the code is a bit confuse... it show all the alphabet char...
but draws a transition between chars (line by line with 20ms between each frame)...
but sure the code is working and draws chars on flipdot :)[#include](http://forum.espruino.com/search/?q=%23include) <SoftwareSerial.h> int compteurG = 0; int compteur = 0; int a = 0; int ncar = 27; boolean drapo = false; byte lettreA[7], lettreB[7]; // assemble message byte msg [11] = { 0x80, // start byte 0x87, // send byte and refresh 0xFF, // to all display adress 0x01, // first data thingy to display, is non printable ASCII 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x8F // end byte }; byte charSet[][7] = { {0x0, 0x0, 0x18, 0x14, 0x14, 0x2e, 0x0}, {0x8, 0x14, 0x14, 0xc, 0x34, 0xa, 0x0}, {0x0, 0x0, 0x18, 0x4, 0x4, 0x3a, 0x0}, {0x8, 0x8, 0x8, 0xc, 0xa, 0x1c, 0x0}, {0x0, 0x0, 0x18, 0x1c, 0x4, 0x1a, 0x0}, {0x10, 0x28, 0x18, 0x8, 0xc, 0xa, 0x4}, {0x18, 0x1c, 0x10, 0x38, 0x14, 0x14, 0x8}, {0x8, 0x14, 0x14, 0xc, 0x14, 0x32, 0x0}, {0x8, 0x0, 0x8, 0x8, 0xc, 0x32, 0x0}, {0x8, 0x0, 0xc, 0x8, 0x18, 0xc, 0xc}, {0x0, 0x24, 0x14, 0xc, 0x14, 0x22, 0x0}, {0x8, 0x14, 0x14, 0x14, 0x8, 0x34, 0x0}, {0x0, 0x0, 0x0, 0x34, 0x2a, 0x2a, 0x0}, {0x0, 0x0, 0x0, 0x18, 0x14, 0x36, 0x0}, {0x0, 0x0, 0x58, 0x34, 0x24, 0x1a, 0x0}, {0x0, 0x0, 0x1c, 0x14, 0x1e, 0x24, 0x4}, {0x0, 0x0, 0x1c, 0x14, 0x3c, 0x12, 0x10}, {0x0, 0x0, 0x1c, 0xc, 0xc, 0x37, 0x0}, {0x0, 0x0, 0x8, 0x14, 0x12, 0x2c, 0x0}, {0x8, 0x3c, 0x8, 0x8, 0x8, 0x34, 0x0}, {0x0, 0x0, 0x0, 0x14, 0x14, 0x1e, 0x0}, {0x0, 0x0, 0x0, 0x34, 0x14, 0xa, 0x0}, {0x0, 0x0, 0x2a, 0x2a, 0x2a, 0x15, 0x0}, {0x0, 0x0, 0x14, 0x8, 0x14, 0x22, 0x0}, {0x0, 0xa, 0xa, 0xc, 0xc, 0xa, 0x4}, {0x0, 0x0, 0x3c, 0x10, 0x8, 0x3c, 0x0}, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} }; [#define](http://forum.espruino.com/search/?q=%23define) TX_ENABLE_PIN 3 // define the EIA-485 transmit driver pin [#define](http://forum.espruino.com/search/?q=%23define) LED_PIN 13 // SoftwareSerial rs485(RO, DI); SoftwareSerial rs485(4, 2); // pins on rs485 module -> void setup() { pinMode(TX_ENABLE_PIN, OUTPUT); // driver output enable rs485.begin (19200); // vitesse com Serial.begin(9600); pinMode(LED_PIN, OUTPUT); // si pas de print softwareSerial ne fonctionne pas Serial.println("7x7 flipdots from Alfazeta"); } void loop() { digitalWrite (TX_ENABLE_PIN, HIGH); // enable transmit driver digitalWrite (LED_PIN, HIGH); // change les lettres tous les 7 tours // remplit les buffers de lettre pour anim de transition de caractère if (compteurG%7 == 0) { for (int i=0;i<7;i++){ lettreA[i] = charSet[compteur%ncar][i]; // caractère avant lettreB[i] = charSet[(compteur+1)%ncar][i]; // caractère après } compteur++; // compteur du caractère à afficher dans charSet } for (int i = 3; i <= a%7+3; i++) { // nbr bits trame msg[i] = lettreB[i-3]; } for (int i = a%7+4; i < 10; i++) { // nbr bits trame msg[i] = lettreA[i-3]; } // envoie la séquence msg[] à l'afficheur for (int i = 0; i < 11; i++) { rs485.write(msg[i]); // flip display print //Serial.print(msg[i],HEX); //Serial.print(" "); } //Serial.println(); // gestion du buffer while (!(UCSR0A & (1 << UDRE0))) // Wait for empty transmit buffer UCSR0A |= 1 << TXC0; // mark transmission not complete while (!(UCSR0A & (1 << TXC0))); // Wait for the transmission to complete digitalWrite(TX_ENABLE_PIN, LOW); // disable transmit driver digitalWrite(LED_PIN, LOW); if (compteurG % 7 == 0) { // si lettre affichée au complet delay(700); } else { // si en cours de transition de lettre delay(20); } if (compteurG >= 7) { compteurG = 0; } else { compteurG ++;} if (a >= 7) { a = 0; } else { a ++;} if (compteur > ncar) { compteur = 0;} }
-
@Gordon, the 7x7 display is around 80€ wo VAT + 23€ for shipping to France + paypal fee
there is an USB version for 5€ more.the baud rate is 9600 or 19200, 38400, 57600 (physical dipswitch on the board)
there is no fonts for the display, it's just a screen, you have to draw your font and convert char to bitsby ex.
Send all white dots to all connected panels (address 0xFF) and turn dots as soon as data is received.0x80 0x87 0xFF 0x7F 0x7F 0x7F 0x7F 0x7F 0x7F 0x7F 0x8F
0x80: header
0x87: command (show)
0xff: address (panel)
7 * 0x7f: display data "b01111111"
0x8f: end chartherefor your exemple need to be converted from hex value to 0/1.
is it good way?parseInt(num, baseFrom).toString(baseTo);
regards
é.
-
Hello,
I've worked/played with a flipdot display from alfazeta (7x7 dots) with an arduino. The display is driven by an rs485 protocole and specific ordered bits...
I would like to use an espruino to do it again.
On arduino we use a software serial
I've read that there is no software serial on espruino
Do i have to use the serial module on specific pin or it is not possible... Not sure to understand?The display use a specific ordered bit sentence compose with 3 bits for command, x bits for data display (depend of size), and an end bit.
Is there an example somewhere to start coding?
Regards
éric
-
-
Hello.
I use console.log for debugging purpose, when the board is unplugged but powered, the prog stop after a while because of the fullness (sorry for the word) of the buffer.
Is there a way to kill output if usb is unplugged? (I'm a lazy guy and don't want to comments all my console.logline.😱)
I suppose there is something to write in the onInit()...Many Thanks
é.
-
-
-
ok i've understood.
i just want to make sequence of actions.
in that case i play with a servo... there is "normal" sequence and a "special" sequence.
all the sequence need a different setInterval
i want to stop one and start the other.
for sure i could use a flag to stop one action and let's play the other and have 2 setInterval started at the beginning.
i'm coming from Flash™ and animation software, therefor i'm thinking as an animator not as a developper... ;)regards
thanks for your time.éric
-
Sorry @Gordon i do not understand the difference between the 2 versions..
what do you mean by callback? is it the function define in the setInterval?
I've tried reinitiate a setInterval at the end of 8 "danse"move but does not works... i've got an unknown interval error!
I'm confusedfunction mecatronique(myId) { var tirage = Math.random(); if (tirage >0.95) { clearInterval(myId); var tm = 800; var compteurDanse = 0; var idDanse = setInterval( function(id) { console.log("danse"); compteurDanse ++; if (compteurDanse >= 8) {clearInterval(id);var idM = setInterval(mecatronique, 500, idM);} }, tm, idDanse); } else { if (tirage >0.6) { console.log("bouge"); } } } function onInit() { var idMeca = setInterval(mecatronique, 500, idMeca); }
sorry for my ugly code
-
-
Hello,
well, i'm a bit loose with setInterval et clearInterval...
I need to repeat 3 time a function with a time of 200ms
I've tried thisid = setInterval( function(a,b,c) { console.log(a,b,c);} ,200, "foo", 25, id);
in the console it said
foo 25 undefined
i've tried to use the id and it "works" (it stop)
var idAnim; var compteur = 0; function anim(a,b,c) { compteur++; console.log(compteur,a,b,c); if (compteur >= a.length){ clearInterval(c); } } function onInit() { idAnim = setInterval( anim, 500, "foo", 0, idAnim); }
and it stops after 3 time.
i've tried the same in a function in a setInterval and it stops all the setInterval
var idAnim; var compteurAnim = 0; var mot = "foo"; function texte(){ idAnim = setInterval(function(a,y,c){ console.log(a,y); compteurAnim++; if (compteurAnim >= a.length) { clearInterval(c);} }, 100, mot, 0, idAnim); mot+="foo"; } function onInit() { setInterval( texte, 4000); }
where i'm wrong?
is there a way to pass the id to function?
or is there a simple way to repeat a definite time a function?
i want to animate text letter by letterregards
éric
-
By the way @Gordon, does the ide use a cache when compile with a new module?
When update the font, i have to rename the module at each iteration to use the updated version in the espruino board.
Is there a better/easier way to disable cache?Regards
-
@Gordon Yes, but i'm not the original designer, i just modified the minus and accents... You have to ask to DennisFont designer...
Regards
-
And i discovered that the é was 1pix larger. I redesign minus with 1 pix larger.
The fontDennisAlternate/* Copyright (c) 2015 Dennis Bemmann. See the file LICENSE for copying permission. */ /* FontDennis8Alt.js ============== from fontDennis8 Redesign mrbbp Usage:
require("FontDennis8Alt").add(Graphics);
g.setFontDennis8Alt();
g.drawString("\x90 \x91\x92\x93\x94\x95\x96\x97 Dennis8 \x9f \x8c \x8d \x89",0,0);
g.drawString("ça ¿s� \xbc\xa3 \xbd\xb5\xa6 \x82\x83\x84\x85 \xac\xad\x86",0,12);
g.drawString("\xa0 Bäh böse Ärzte in Küche\xaf",0,24);*/ var font = atob("AAAAAPoAwADAAFhw2HDQAGSS/5JMAGCW+DzSDAxSolIMEsAAPEKBAIFCPABIMOAwSAAQEHwQEAABBgAQEBAQAAIAAwwwwAB8ipKifABA/gBChoqSYgCEkrLSjAAYKEj+CADkoqKinAA8UpKSDACAgI6wwABskpKSbABgkpKUeAAiAAEmABAoRAAoKCgoKABEKBAAQIqQYAA8WqW9RDgOOMg4DgD+kpKSbAB8goKCRAD+goJEOAD+kpKCAP6QkIAAfIKCklwA/hAQEP4A/gAMAgIC/AD+EChEggD+AgICAP5AIED+AP7AMAz+AHyCgoJ8AP6QkJBgAHyChoN8AP6QmJRiAGSSkpJMAICA/oCAAPwCAgL8AOAYBhjgAPAOMA7wAMYoECjGAMAgHiDAAI6SosIA/4EAwDAMAwCB/wBAgEAAAQEBAQEBEn6SggQABCoqKh4A/iIiIhwAHCIiIhQAHCIiIv4AHCoqKhgAEH6QkIAAGCUlJR4A/iAgIB4AvgACAQG+AP4ICBQiAPwCAgA+IB4gHgA+ICAgHgAcIiIiHAA/JCQkGAAYJCQkPwA+ECAg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DBgYGBgYGBgYCAwQGBAUGBgYGBgUFBgYCBgYFBgYGBgYGBgYGBgYGBgUDBQMEBgYGBgYGBgYGBgIFBgQGBgYGBgYGBQYGBgYGBgQCBAYGBgQGBgYGBgYGBQUGBgYGBgYGBgYGBgYGBgQCAwQFBgYGAgYGBgYGBgYGBgYGBgYGBQYFBQQGBgMEBAYGBgYGBQYGBgYGBgYGBgYGBgQEBAQGBgYGBgYGBgYGBgYGBgYFBgYGBgYGBgYGBgYGBAQEBAYGBgYGBgUGBgYGBgYGBQY="); exports.add = function(graphics) { graphics.prototype.setFontDennis8Alt = function() { this.setFontCustom(font, 32, widths, 8); } }
-
Hi @MaBe,
They come from ebay, hongkong
0,98" 128x32 i2c oled display they are in white and blue. Be aware in the description
Regards -
Many Thanks @Gordon, it works great!
I use it with DennisFont (cause i'm writing in french, have to had more chars, count until 255) with a height of height (arf)
i keep line 4 to 34 and modifying as follow afterrequire("FontDennis8").add(Graphics); function centre(text, y) { g.drawString(text, (g.getWidth() - g.stringWidth(text))/2, y); } function init() { g.clear(); g.setFontDennis8(); centre("en attendant",22); g.flip(); doFont(); g.clear(); g.setColor(1); g.setFontDennis8(); centre("en short",22); g.fillRect(10,0, g.getWidth()-20, 18); g.setColor(0); g.setFontCustom(charData, charFrom, charWidths, charHeight); centre("Ta m\xe8re",2); // affiche g.flip(); } var g; function onInit() { // initialise l'écran oled I2C1.setup({scl:B6,sda:B7}); g = require("SSD1306").connect(I2C1, init, { height : 32 }); }
regards
éric
-
@gordon, it works, BUT, the DennisFont has no fixed width. there is less width for an "i" or "l" than a "e"... and there is a gap...
i've tried thatg._ds = g.drawString; g.drawString = function(s,x,y) { s=s.toString(); for (var i=0;i<s.length;i++) g._ds(s[i],x+=(g.stringWidth(s[i])+2),y); };
it does not work for fine letter as i, l
any idea?
regards -
-
thanks @Gordon, and if i follow, the "10" is the step for letter width + kerning?
The other way:
i've used the online tool to convert and check the autoWidth, i should try with a fixed width with a double pixel as kerning... -
Thanks very much @Gordon
I've use the digitalWrite(TX_ENABLE_PIN, 1)
With higher than 9600 baud rate, some frame are lost and display do not completely refresh.
It does not occur at 9600.
Alfazeta display are compatible with espruino👏🏼🎉 and with a simple way...
I love simple things.