In the anonymous function in your onInit() code I would expect the displayPixel() first and then the digitalPulse() for the latching (flank) and (combined?) the output enable for a particular time (apply the power to the coil)... - in other words, flip the lines 28 and 29, and allow a much longer pulse...
What type of shift register are you using?
Btw, you can save yourself some work by using MC / Eespruino built-in SPI (serial peripheral interface) appliance: assuming, there are two shif registers, one for x (0..5) and the other one for y (0..6) and the shift registers are in series - first x, then y - then you have an easy game:
// SPI1 and ports for Espruino Pico / Wifi and 74HC595 shift registers
SPI1.setup({mosi:B5, sck:B3}); // SPI1, other SPIx can do too
var dnss = A0; // nss pin used for the latching,
var pls = A1; // for the _OE (neg output enable)
var dat = new Uint8Array(2);
function setPxl(x,y,p) { // polarity 0,1
x=Math.floor(x); y=Math.floor(y); // optional
x=(x>4)?4:(x<0)?0:x; y=(y>6)?6:(y<0)?0:y; // optional
d[0]=Math.pow(2,y); d[1]=Math.pow(2,x); d[p]^=0xFF;
SPI1.write(d,dnss); digialPulse(pls,1,10);
}
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
In the anonymous function in your
onInit()
code I would expect thedisplayPixel()
first and then thedigitalPulse()
for the latching (flank) and (combined?) the output enable for a particular time (apply the power to the coil)... - in other words, flip the lines28
and29
, and allow a much longer pulse...What type of shift register are you using?
Btw, you can save yourself some work by using MC / Eespruino built-in SPI (serial peripheral interface) appliance: assuming, there are two shif registers, one for x (0..5) and the other one for y (0..6) and the shift registers are in series - first x, then y - then you have an easy game: