Jump to content
Issues with Images is known, we are working on it. ×

Recommended Posts

Posted

Does anyone know of a method of getting some clarification on what the expected output of programs should be?
I've tried going through LEGO Customer Service but I'm not really getting anyway (they also can't receive images / videos via the support emails so that makes it harder)

I've been writing some small testing scripts to extract behaviours of the different micropython functions on the hub but some of the outcomes are odd.

Here's an example in the app using the blocks:

rotate.jpg.c8ca06950f9dd83289b76075650e4d98.jpg

Or in micropython:

from hub import display
from utime import sleep

display.pixel(0,0,100)
sleep(1)
display.rotation(90)
sleep(1)
display.pixel(0,0,100)
sleep(1)
display.rotation(-90)
sleep(1)
display.pixel(0,0,0)

They both give the same results:

output_actual.gif.3a3bac6028aac25b3ef9037c494fc6ce.gif

While I would expect it to have done something like this:

output_expected.gif.6049ca67032d3303f26af5497ba6fda3.gif

Posted (edited)

I'm happy with them staying activated, I'm just confused about what rotate is actually doing.
I'd either expect it to rotate what's on the screen but not change the indexing of pixels (so 0,0 is always the top left)
Or I'd expect it to rotate what's on the screen and change the indexing (so 0,0 would be the top right after a 90 degree rotation and it would be the bottom right after a 180 degree rotation)
Neither of these is what happens.

Edited by gw_shadow
Posted (edited)

I've tried that too. If I run this script:

from hub import display
from utime import sleep

display.clear()
sleep(1)

display.pixel(0,0,100)
sleep(1)
display.rotation(90)
sleep(1)
display.pixel(0,0,100)
sleep(1)
display.rotation(90)
sleep(1)
display.pixel(0,0,100)
sleep(1)
display.rotation(90)
sleep(1)
display.pixel(0,0,100)
sleep(1)
display.rotation(90)
sleep(1)

I get this result:

output.gif.2218d85b7bfd33d84cc911219563af75.gif

I'm at a loss.

Ah, and if I run it twice in a row without doing a soft reset in between it does this...

output2.gif.a50fb9a9e86f6cb7f6ff02a4fef478e8.gif

---

Edit: Ah the reason for the first result being super weird (jumping 180) seems to be some internal state that only gets applied after the first rotate call, if I do a hard reset then run the script it only jumps 90 and otherwise follows the same pattern as the final gif.

Edited by gw_shadow

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...