Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from microbit import *
- while True:
- sound = pin0.read_analog()
- if sound<=100:
- volume = 0
- elif sound<=200:
- volume = 1
- elif sound<=300:
- volume = 2
- elif sound<=400:
- volume = 3
- elif sound<=500:
- volume = 4
- elif sound<=600:
- volume = 5
- elif sound<=700:
- volume = 6
- elif sound<=800:
- volume = 7
- elif sound<=900:
- volume = 8
- else:
- volume = 9
- for a in range(5):
- for b in range(5):
- display.set_pixel(a, b, volume)
- sleep(1000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement