-
Hey Kylir
I created an NPM module...you can check it out here:
https://www.npmjs.com/package/espruino-adafruit-led-backpackFeel free to contribute additional functionality via GitHub :)
But I have the basics of drawing implemented :)
Regards
Andrew -
@Gordon How do I go about contributing modules to the Espruino project?
-
I created a git repo with tests and this is the function we got to get it working:
module.exports = function rotate(value) { var rotated = value >> 1; // Check to see if the first bit was set... if (1 & value) { //...flip the furthest bit on. rotated += (1 << 7); } return rotated; };
-
Thanks for getting me this far!
return (a>>1)||(a<<7);
This rotated the pixels correctly except for one last issue...
I can draw a line, I can set a pixel anywhere in the grid.
If the left most
x
is on0
and it doesn't share the row with another pixel it will show up. If it does share with another pixel, it switches off.g.clear(); //face top g.setPixel(2,0); g.setPixel(3,0); g.setPixel(4,0); g.setPixel(5,0); g.setPixel(1,1); g.setPixel(6,1); //face left g.setPixel(0,2); g.setPixel(0,3); // Won't show because of eyes on 2 and 5. g.setPixel(0,4); g.setPixel(0,5); //eyes g.setPixel(2,3); g.setPixel(5,3); //face right //g.setPixel(7,2); //g.setPixel(7,3); //g.setPixel(7,4); //g.setPixel(7,5); //face bottom g.setPixel(2,7); g.setPixel(3,7); g.setPixel(4,7); g.setPixel(5,7); g.setPixel(1,6); g.setPixel(6,6); g.flip();
If I comment out the eyes the left most pixel will show:
g.clear(); //face top g.setPixel(2,0); g.setPixel(3,0); g.setPixel(4,0); g.setPixel(5,0); g.setPixel(1,1); g.setPixel(6,1); //face left g.setPixel(0,2); g.setPixel(0,3); // Won't show because of eyes on 2 and 5. g.setPixel(0,4); g.setPixel(0,5); //eyes //g.setPixel(2,3); //g.setPixel(5,3); //face right //g.setPixel(7,2); //g.setPixel(7,3); //g.setPixel(7,4); //g.setPixel(7,5); //face bottom g.setPixel(2,7); g.setPixel(3,7); g.setPixel(4,7); g.setPixel(5,7); g.setPixel(1,6); g.setPixel(6,6); g.flip();
-
-
PaintYourDragon from adafruit said this on Twitter:
It's wired that way for routing reasons; need to ROL or ROR (forget
which).https://twitter.com/paintyourdragon/status/663086330834907136
I don't understand what that means :)
-
-
-
Thank you so much Gordon! I am so happy to see something come alive!
I used this:
var g = Graphics.createArrayBuffer(16,8,1);
To get this result -
Is that what you were expecting?
Also, I'm giving a talk on the state of JavaScript and IoT at Node.js Interactive and at FluentConf next year and I'm showcasing the Pico along with other things!
-
I purchased this Small 1.2" 8x8 Ultra Bright Square White LED Matrix + Backpack.
I got it working with an Arduino to make sure everything is wired up correctly and it does work.
I believe it uses the MAX7219 driver but can't get it to work. Adafruit uses I2C and the Espruino library uses SPI.
Is there any raw I2C code I can use to test it out. I've wired up the - + to GND and 5v, and C to B6 and D to B7.
I2C1.setup({scl:B6, sda:B7});
Thanks
-
-
The module uses a similar API to what the arduino library had for the backpack. It uses the graphics API in the module :)