I am currently now trying to do a little mini project to get my brain into the right gear before I work on my overall project.
so a Knightrider loop (classic and imaginative i know);
What im thinking, is instead of a Uint8Array I could use simply a variable. So for say 5 LED's;
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,]
Then within the loop i'd need;
something that increments by 3 each time (so I can move from Red LED to Red LED each time)
Then using the above which goes 0,3,6,9,12 I can tell it to modify the position within my 5 LED variable.
I'd then also need something to reset the previous so? modify i-3 to 0.
SPI2.send4bit.....
Delay
So what im doing is creating a blanket 5 LED strip of 'off' LED's in a variable, then each time the loop goes round using the 0,3,6,9,12 I can modify the value of the Red LED within that variable and resend the entire thing.
im sure that's rather inelegant but I can come up with more creative ways later ;)
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.
I am currently now trying to do a little mini project to get my brain into the right gear before I work on my overall project.
so a Knightrider loop (classic and imaginative i know);
What im thinking, is instead of a Uint8Array I could use simply a variable. So for say 5 LED's;
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,]
Then within the loop i'd need;
So what im doing is creating a blanket 5 LED strip of 'off' LED's in a variable, then each time the loop goes round using the 0,3,6,9,12 I can modify the value of the Red LED within that variable and resend the entire thing.
im sure that's rather inelegant but I can come up with more creative ways later ;)