Most recent activity
-
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 :)
-
-
The module uses a similar API to what the arduino library had for the backpack. It uses the graphics API in the module :)