• Non ci sono risultati.

MagicTrick Part 2

N/A
N/A
Protected

Academic year: 2021

Condividi "MagicTrick Part 2"

Copied!
4
0
0

Testo completo

(1)

MagicTrick Part 2

Before you begin this lesson, make sure you've completed MagicTrick Part 1!

This lesson is an extension on Part 1 and will show you how to shake the phone to perform the trick.

Getting Started

Make sure you are logged on to ai2.appinventor.mit.edu and MagicTrick (from Part 1) is showing in your Designer.

MagicTrick Part 2 - 1 Teaching App Creation

(2)

Adding the Accelerometer Sensor Component

Go to Sensors. Click and drag the Accelerometer Sensor into the Viewer. Notice that it drops down under "Non-visible components" because it is not something that will show up on the app's user interface.

Switch to the Blocks Editor.

Now switch back to the Blocks Editor so we can program the phone to perform the trick when shaking.

Click Blocks to switch.

MagicTrick Part 2 - 2 Teaching App Creation

(3)

Program with the Sensor

Click on AccelerometerSensor1 under Screen1. Click and drag the block that says "when

AccelerometerSensor1.Shaking". This is an event handler that is called when the phone is shaken.

Duplicating the Blocks

When the phone is shaking, we want the image to change and the sound to play. We can use the

"duplicate" feature to copy the blocks. Right click on the "set HatButton.Image to" block and select duplicate. Move this block into the "Shaking" event handler. Repeat for the "call Sound1.Play" block.

MagicTrick Part 2 - 3 Teaching App Creation

(4)

Try it out!

Try shaking the phone! Does the image change? Does the sound play?

Great job!

You just finished MagicTrick Part 2! Great job!

MagicTrick Part 2 - 4 Teaching App Creation

Riferimenti

Documenti correlati

However, as Finegood and Tzur state in their paper, ‘‘the approach taken and the (volume) estimate used will affect the magnitude of S G BRCLAMP and could impact on the conclusion

Reply to the letter to the editor ‘European cancer mortality predictions for the year 2019 with focus on breast cancer, by Malvezzi M et al’ by Marsden and Hamoda, On behalf of

Self-organizing 3D human neural tissue derived from induced pluripotent stem cells recapitulate Alzheimer’s disease phenotypes. Large- scale production of mature neurons from

Norata, PhD Centro SISA per lo Studio della Aterosclerosi Ospedale Bassini Cinisello Balsamo Milano, Italy Department of Pharmacological Sciences University of Milan Milan,

Il team di Geo4Fun è quindi andato spedito alla proposta di un’intervista al fondatore e CEO di questo bellissimo progetto che mette insieme il mondo dei Geo Podcast e

16 Oligomeric structures are expected to be more appropriate mimics of the lignin struc- ture than dimeric and trimeric compounds and also our model, containing a

Since her behavior does not affect the agent’s (already chosen) action, she designs the most profitable informal agreement (either involving collusion or extortion) which involves

Since the set of adiabatic states (21) provide an accurate approximation of the entire set of Floquet eigenvectors of H(t) over one oscillation cycle, when the system dynamics