41 lines
1.0 KiB
Markdown
Raw Normal View History

2016-03-25 16:47:20 -07:00
# magic logo activity
Show an image that points up when the logo is up.
## ~avatar avatar
2016-03-25 16:47:20 -07:00
Welcome! This tutorial will help you display an arrow pointing toward the logo! Let's get started.
## ~
2016-03-25 16:47:20 -07:00
2016-11-01 17:44:37 -07:00
Using the **accelerometer** sensor, the @boardname@ can detect when the **logo** is oriented **up**. We call that the **logo up** event. We will use `on logo up` to register an event handler that will run when the **logo up** event happens.
2016-03-25 16:47:20 -07:00
```blocks
2016-04-13 09:03:10 -07:00
input.onGesture(Gesture.LogoUp, () => {
2016-03-25 16:47:20 -07:00
})
```
2016-11-01 17:44:37 -07:00
When the @boardname@ goes logo up, the code nested under the `on logo up` function will run. Let's add a line of code to show LEDs in there.
2016-03-25 16:47:20 -07:00
```blocks
2016-04-13 09:03:10 -07:00
input.onGesture(Gesture.LogoUp, () => {
2016-03-30 15:11:05 -07:00
basic.showLeds(`
2016-03-25 16:47:20 -07:00
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
})
```
2016-11-01 17:44:37 -07:00
Run your code and try to turn around the @boardname@ to see the **logo up** event in action!
2016-03-25 16:47:20 -07:00
## ~avatar boothing
2016-03-25 16:47:20 -07:00
2016-04-13 08:27:45 -07:00
Excellent, you're ready to continue with the [challenges](/lessons/magic-logo/challenges)!
2016-03-25 16:47:20 -07:00
## ~
2016-03-25 16:47:20 -07:00