# data[].attributes.body
1. Draws A Happy Face on Microbit
display.show(Image.HAPPY)

2. Draws A Sad Face on Microbit
display.show(Image.SAD)

# data[].attributes.body
1. Sleeps code for 1 second
sleep(1000)

2. Displays Giraffe for one second before flashing to a Duck
display.show(Image.GIRAFFE)
sleep(1000)
display.show(Image.DUCK)

# data[].attributes.body
1.Displays text scrolling across Microbit
display.scroll('Charlotte')

# data[].attributes.body
1.Temperature Function:
temperature()

2.Scrolling Temperature
display.scroll(str(temperature()))

# data[].attributes.body
1.Measuring Moisture
pin0.read_analog()

2.Scroll Moisture
display.scroll(str(pin0.read_analog()))

# data[].attributes.body
1.Button _ is pressed:
if button_[].is_pressed():

2.Take note of indentation

3.Code should look like:
while True:
if button_[].is_pressed():
{effect}

while True:
if button_[].is_pressed():
{effect}
else:
{effect}

while True:
if button_[].is_pressed():
{effect}
elif button_[].is_pressed():
{effect}
else:
{effect}

while True:
if button_[].is_pressed() and button_[].is_pressed():
{effect}
elif button_[].is_pressed():
{effect}
elif button_[].is_pressed():
{effect}
else:
{effect}

# data[].attributes.body
1.Display a certain custom image:
display.show(Image('60906:06960:99999:06960:60906'))

2.How to formulate 5 number displays
Within the brackets are 5 sets of strings

Each line is a row of the image and ends with a colon (:)

Each number is the pixel brightness from 0(off) to 9 (fully on)

3.How to display certain images with 3 numbers
display.set_pixel(0, 0, 9)

4.Variables to display images with pixels
x = 0
y = 0
while True:
display.set_pixel(x,y,9)
if button_a.was_pressed():
display.clear()
if x == 4:
x = 0
else:
x = x + 1
if button_b.was_pressed():
display.clear()
if y == 4:
y = 0
else:
y = y + 1

# data[].attributes.body
1.Import music
import music

2.Play music
music.play(music.ENTERTAINER)

3.All music track
music.play(music.BA_DING)
music.play(music.FUNK)
music.play(music.PUNCHLINE)
music.play(music.POWER_UP)
music.play(music.POWER_DOWN)
music.play(music.ENTERTAINER)

4.Playing notes
music.play('F6')
(F in 6th octave)

# data[].attributes.body
1.Make a variable
goal = Image.ARROW_W

2.Using variable in notes
goal = Image.ARROW_W
while True:
if button_a.is_pressed():
display.show(goal)
sleep(500)
display.clear
if button_b.was_pressed():
goal = Image.ARROW_E
(goal is arrow_w first but after button b is pressed the variable changes)

# data[].attributes.body
1.Goes on forever
while True

# data[].attributes.body
1.Using the accelerometer
if accelerometer.was_gesture("shake"):

2.Using conditions w accelerometer
if accelerometer.was_gesture("shake") == False/True:

# data[].attributes.body
print()

# data[].attributes.body
Addition: +
Subtraction: -
Division: /
Multiplication: *