← index #7081Issue #2881
Off-topic · high · value 1.715
QUERY · ISSUE

display.get_pixel unexpected output on microbit

openby marc0janssenopened 2021-03-29updated 2024-09-13
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.py get_pixel() and set_pixel() methods are not mutually compatible

closedby peterhinchopened 2017-02-17updated 2017-02-21

The following produces a surprising (to me, at least) colour change:

import lcd160cr
lcd = lcd160cr.LCD160CR('X')
lcd.set_orient(lcd160cr.PORTRAIT)
lcd.set_pos(0, 0)
lcd.set_text_color(lcd.rgb(255, 0, 0), lcd.rgb(0, 0, 0))
lcd.set_font(1)
lcd.write('Hello MicroPython!')
print('touch:', lcd.get_touch())
for y in range(10):
    for x in range(60):
        lcd.set_pixel(x, y, lcd.get_pixel(x, y))

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied