Two Ways of Making a Drawing App

by huffpuffr in Circuits > Microcontrollers

462 Views, 1 Favorites, 0 Comments

Two Ways of Making a Drawing App

micro bit.png

I know this drawing app only has a 5x5 pixel screen so you really can't make much but it's still fun.

Supplies

  • computer
  • mini USB cord
  • micro bit

The First Way

This is not my favorite way but it is a little faster to draw with.

The Inputs

Screenshot 2020-11-18 205210.png

drag out the following:

(on logo down)

(on logo up)

(on tilt left)

(on tilt right)

(on button A)

(on button B)

from INPUT

Filling the Inputs

Screenshot 2020-11-18 210257.png

In (on logo down) put:

  • (forward 1 steps)

In (on logo up) put:

  • (back 1 steps)

in (tilt left) put:

  • (turn left)
  • (forward 1 steps)
  • (turn right)

in (tilt right) put:

  • (turn right)
  • (forward 1 steps)
  • (turn left)

in (on button A) put:

  • (pen up)

in (on button B) put:

  • (pen down)

Downloading and Using It

Screenshot 2020-11-18 213009.png

To download, just plug the micro bit into your computer and press the download button.

To use, it's pretty simple. Just press A to start drawing, B to stop. Tilt the direction you want to go.

The Second Way

I like this way better but drawing is slower.

The Inputs

Screenshot 2020-11-19 093337.png
2.png
Screenshot 2020-11-19 0935092.png
Screenshot 2020-11-19 101646.png

first you have to create a new variable called ( b or f )

drag out the following:

  1. (on button A pressed)
  2. (on button A pressed)
  3. (on button B pressed)

open the drop down on one of the (on button A pressed) and choose A+B

Filling the Inputs

Screenshot 2020-11-19 094249.png
Screenshot 2020-11-19 095423.png

In (on button A pressed)

  • (forward 1 steps)

in (on button B pressed)

  • (turn right)
  • (forward 1 steps)
  • (turn left)

in (on button A+B pressed)

  • if <true> then ( ) else ( )

Filling the If Then ( ) Else ( ) (part 1)

Screenshot 2020-11-19 095921.png
Screenshot 2020-11-19 100305.png

in the if < > put a ( 0 )=( 0 )

in the ( 0 )=( 0 ) put a ( b or f )=( false )

Filling the If Then ( ) Else ( ) (part 2)

Screenshot 2020-11-19 102354.png
Screenshot 2020-11-19 102833.png
Screenshot 2020-11-19 103433.png

in if ( ) put:

  • (pen down)
  • (set b or f to ( 0 )

in the ( 0 ) put a <true>

in the else put:

  • (pen up)
  • (set (b or f) to ( 0 )

in the ( set b or f to < false> )

DONE!!!!!!!!!!

Using It

Press A to go up. Press B to go right. Press A and B at the same time to start drawing and again to stop. If you go all the way to the right or top it will put you on the opposite side.