MrYsLab / s2m

Scratch to micro:bit bridge.
https://mryslab.github.io/s2m/
GNU Affero General Public License v3.0
35 stars 19 forks source link

"Tilted up?" block gives "true" when micro:bit is tilted down #5

Closed champierre closed 6 years ago

champierre commented 6 years ago

"Tilted up?" block gives "true" when micro:bit is tilted down, and "Tilted down?" returns "true" when micro:bit is tilted up.

MrYsLab commented 6 years ago

This may have been fixed with the release v1.09. The way I define Tilted up is if you have the LED display facing you and the USB connector at the top. If you then rotate the board so that the USB connector is closer to your face, then this is a tilted up condition. If you rotate the board so that USB connector is pointing towards the floor, then this is a tilt down condition.

Please let me know if you still feel this is incorrect.

champierre commented 6 years ago

OK. My misunderstanding came from that I thought "tilt up" is "tilt forward" and "tilt down" is "tilt backward" with the situation that LED display is facing to the ceiling and USB connector is facing forward.

Micro:bit blocks editor uses "logo up" and "logo down" instead of "tilt up" and "tilt down". Maybe it would be better to be consistent with that.

MrYsLab commented 6 years ago

I just loaded this script into the micro:bit and it is consistent with the way I defined up and down:

from microbit import *

while True:
    gesture = accelerometer.current_gesture()
    if gesture == "up":
        display.show(Image.HAPPY)
    else:
        display.show(Image.ANGRY)

I am not sure if there is inconsistency in the terminology between JavaScript/Blocks and micropython, but I prefer to use the micropython definitions.