5. Scratch Programming

Here are some very basic programs you may try for yourself to start drone programming with Scratch and the Tello!

5.1. Hello, World!

Every programming attempt needs a Hello, world! example. This program simply lifts up the drone and tells it to land again.

_images/hello-world.png

Code

5.2. Going up and down

This program sends the drone up and then down.

_images/up-down.png

Code

5.3. Left or right?

This program makes the drone fly left then right.

_images/left-right.png

Code

5.4. Forward, then backward

This program flies the drone forward then backward.

_images/forward-back.png

Code

5.5. Turning around and around

How about rotating the drone clocwise cw then counter-clockwise ccw?

_images/cw-ccw.png

Code

5.6. Simple flight

Simple flying.

_images/simple-flight.png

Code

5.7. Flip meow

Flip and meow!

_images/flip-meow.png

Code

5.8. Flipping out

Can we make the drone flip out?

_images/flip-with-duration1.png

Code

5.9. Manual control

Can we manually control the drone? YES, WE CAN!. Note the following.

  • up arrow flies forward

  • down arrow flies backward

  • left arrow flies left

  • right arrow flies right

  • q makes the drone take off

  • w lands the drone

  • a rotates the drone clockwise by 45 degrees

  • s rotates the drone counter-clockwise by 45 degrees

_images/manual-control.png

Code

5.10. Spicy manual control

Let’s spice it up with manual controls! Sounds + motion with the cat!

_images/manual-control-spicy.png

Code

5.11. Square

Too square!

_images/square-flight.png

Code

5.12. Square flips

A square with flips!

_images/square-and-flips.png

Code

5.13. Spaceship

A UFO spaceship?

_images/spaceship.png

Code