Avatar for Mrbbp

Mrbbp

Member since Mar 2017 • Last active Aug 2018
  • 10 conversations
  • 69 comments

I'm newb with espruino, not with arduino, not with js...
But i'm not a coding ninja

Most recent activity

  • in Interfacing
    Avatar for Mrbbp

    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.

  • in JavaScript
    Avatar for Mrbbp

    Oh great this exactly what i'm looking for.
    Want to display text on display reflected in water...
    Thanks.

    é

  • in Interfacing
    Avatar for Mrbbp

    Ok, soooo i did it.
    Espruino (Pico) for drawing text + Arduino (Nano) for controlling through a serial com @19200

    Arduino code

    
     [#include](http://forum.espruino.com/sea­rch/?q=%23include) <FlipDot_5x7.h>
     [#define](http://forum.espruino.com/sear­ch/?q=%23define) CLOCK 13
     [#define](http://forum.espruino.com/sear­ch/?q=%23define) DATA  11
     [#define](http://forum.espruino.com/sear­ch/?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)

  • in Interfacing
    Avatar for Mrbbp

    I've decided to work by a different way. Too many time lost on that.
    I'm connecting the espruino to an arduino which control the flipdot display trough a serial wire to transfer an arrayBuffer.

  • in General
    Avatar for Mrbbp

    yes, great the use of println()... there is a final CR, easy to detect to call the refresh display function.
    thanks.

    é.

  • in General
    Avatar for Mrbbp

    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

  • in General
    Avatar for Mrbbp

    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?

  • in General
    Avatar for Mrbbp

    Hello,

    i'm trying to work with arrayBuffer but i'm bad...
    I'm using exemple in the graphics library at Internal Use

    require("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

Actions