• 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 this

    var 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 data

    data = 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

    é.

About

Avatar for Mrbbp @Mrbbp started