Add option to control micro:bit accelerometer with mouse#4
Open
notexactlyawe wants to merge 2 commits intopddring:masterfrom
Open
Add option to control micro:bit accelerometer with mouse#4notexactlyawe wants to merge 2 commits intopddring:masterfrom
notexactlyawe wants to merge 2 commits intopddring:masterfrom
Conversation
Author
|
One extra note, I've put it up on my domain (using GH pages) so you can play around with it: |
Sliders now move along with the value Value update is debounced to reduce CPU usage (30fps) Value spans have minimum width to prevent them expanding and contracting endlessly, which is visually distracting Ran mb.css through a CSS validator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Firstly, thanks for making this, it's been a huge help in past workshops!
I have a workshop that gets people to build a snake game on micro:bit using the accelerometer. If they tilt the device forward, then the snake will move up the screen; if they tilt it to the left then the snake will move in a leftwards direction.
While this code can be simulated with this repository, it can be a bit inconvenient to have to adjust each accelerometer axis separately to make the snake move. This PR adds in the ability to change the accelerometer X and Y according to the mouse position.
I've added a checkbox to the accelerometer tab that allows this to be turned on and off since it would be surprising behaviour without explicitly requesting it. When the checkbox is ticked, the user can move the mouse within the
#microbitelement and the accelerometer values will change. In the snake example, it looks like the snake is trying to follow the mouse, which feels intuitive.I tried to add animations which you can test out in the mouse-accel-anim branch but I didn't like how they turned out. They made the screen more difficult to see, and it was hard to differentiate left from right and up from down.
If you want to test this code with the snake program, it's available in ears-edi/microbit-snake.
Let me know what you think!