Two Ways of Making a Drawing App
by huffpuffr in Circuits > Microcontrollers
472 Views, 1 Favorites, 0 Comments
Two Ways of Making a Drawing App

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

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

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

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




first you have to create a new variable called ( b or f )
drag out the following:
- (on button A pressed)
- (on button A pressed)
- (on button B pressed)
open the drop down on one of the (on button A pressed) and choose A+B
Filling the Inputs


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)


in the if < > put a ( 0 )=( 0 )
in the ( 0 )=( 0 ) put a ( b or f )=( false )
Filling the If Then ( ) Else ( ) (part 2)



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.