QUERY · ISSUE
display.get_pixel unexpected output on microbit
port-nrf
hi there,
The display.get_pixel method with a full bright pixel on the a microbit returns a "255" instead of a "9".
This is not conform the docs on internet. The method should have returned a "9" for a full pixel.
It seems the display.get_pixel method returns a value between 0-255 instead of 0-9.
from microbit import *
display.set_pixel(0, 0, 9)
display.scroll(str(display.get_pixel(0, 0)))
CANDIDATE · ISSUE
lcd160cr get_line() method produces unexpected bytearray offset
import lcd160cr
buf = bytearray(20)
lcd = lcd160cr.LCD160CR('Y')
lcd.set_orient(lcd160cr.LANDSCAPE)
x = 5
y = 1
lcd.set_pixel(x, y, lcd.rgb(255,255,255))
lcd.set_pixel(x + 1, y, lcd.rgb(255,255,255))
lcd.get_line(x, y, buf)
print(buf)
Outcome
bytearray(b'\x0c\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
I tried various values of x and y, and both landscape and portrait modes: the result is always displaced by one byte. The contents of byte 0 seems to depend on orientation.