m3pi 8 leds

02 Dec 2011

How does one drive the 8 leds, on or off?

This is confusing for I see leds(int val)

How would I turn on 1st, and last, pin 20 and pin 13, and all the rest off?

Someone please try it.

Thanks, donde

02 Dec 2011

Hi Donde,

It's implemented as an 8 bit bus with one LED per bit, so you can use a bit mask - it is probably easier to think of in Hexadecimal rather than a decimal integer.

If you're a little rusty on Hexadecimal, check out :

Hope this helps, Chris

04 Dec 2011

Thanks Chris I realize that now, but looking at the m3pi cookbook, an example would have been helpful. But, look what I did above for the topic of "Knight Rider w/o wait." and without bit shift! I started it with just 4 LEDS, but had to finish it with 8. Not very efficient code, I suppose. donde