rjbatista / tm1638-library

Automatically exported from code.google.com/p/tm1638-library
141 stars 75 forks source link

setLEDs function does not set all of the LEDs #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Run the line "module1.setLEDs(0x0F);"
2.Rune the line "module1.setLEDs(0xF0);"

What is the expected output? What do you see instead?
1. Expect to see all LEDs as red. Only the left four light up red.
2. Expect to see all LEDs as green. Only right four light up, and as red.

Original issue reported on code.google.com by dacomput...@gmail.com on 15 Dec 2011 at 10:24

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
The expected output is wrong, but I checked the library reference and the 
setLEDs method was wrongfully documented.

The input is not a byte but a word (16 bits, one for each LED): the most 
significant byte is for the green LEDs and the least significant byte is for 
the red LEDs. 

This will set all the LEDs red:
  module.setLEDs(0xFF);

This will set all the LEDs green:
  module.setLEDs(0xFF00);

This will set alternating red and green LEDs:
  module.setLEDs(0b0101010110101010);

Original comment by rjbati...@gmail.com on 15 Dec 2011 at 10:44