Add kitronic 4 and 5
This commit is contained in:
parent
4f2befc8f0
commit
70b253c85f
2 changed files with 29 additions and 0 deletions
18
kitronic_04.py
Normal file
18
kitronic_04.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
from microbit import *
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
duty = 0
|
||||||
|
while True:
|
||||||
|
while duty < 1023:
|
||||||
|
pin0.write_analog(duty)
|
||||||
|
duty += 1
|
||||||
|
sleep(10)
|
||||||
|
while duty > 0:
|
||||||
|
pin0.write_analog(duty)
|
||||||
|
duty -= 1
|
||||||
|
sleep(10)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
11
kitronic_05.py
Normal file
11
kitronic_05.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
from microbit import *
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
while True:
|
||||||
|
value = min(1023, abs(accelerometer.get_y()))
|
||||||
|
pin0.write_analog(value)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in a new issue