Microbit/microbit/__init__.py

changeset 11
c8198736bff3
parent 10
f34fe5abe069
--- a/Microbit/microbit/__init__.py	Wed Apr 29 18:26:18 2020 +0200
+++ b/Microbit/microbit/__init__.py	Sun Apr 04 16:54:03 2021 +0200
@@ -22,9 +22,12 @@
 def temperature():
     pass
 
+def set_volume(volume):
+    pass
+
 ######################################################################
 
-class MicroBitButton():
+class Button():
     def is_pressed(self):
         pass
     
@@ -34,11 +37,21 @@
     def get_presses(self):
         pass
 
-button_a = MicroBitButton()
-button_b = MicroBitButton()
+button_a = Button()
+button_b = Button()
 
 ######################################################################
 
+class MicroBitTouchOnlyPin():
+    RESISTIVE = 0
+    CAPACITIVE = 1
+    
+    def is_touched(self):
+        pass
+    
+    def set_touch_mode(self, mode):
+        pass
+
 class MicroBitDigitalPin():
     PULL_UP = 0
     PULL_DOWN = 1
@@ -94,6 +107,9 @@
     def set_analog_period_microseconds(self, period):
         pass
     
+    def get_analog_period_microseconds(self):
+        pass
+    
     def set_pull(self, mode):
         pass
     
@@ -108,6 +124,9 @@
     PULL_DOWN = 1
     NO_PULL = 2
     
+    RESISTIVE = 0
+    CAPACITIVE = 1
+    
     def read_digital(self):
         pass
     
@@ -126,7 +145,7 @@
     def set_analog_period_microseconds(self, period):
         pass
     
-    def is_touched(self):
+    def get_analog_period_microseconds(self):
         pass
     
     def set_pull(self, mode):
@@ -137,6 +156,12 @@
     
     def get_mode(self):
         pass
+    
+    def is_touched(self):
+        pass
+    
+    def set_touch_mode(self, mode):
+        pass
 
 pin0 = MicroBitTouchPin()           # Pad 0
 pin1 = MicroBitTouchPin()           # Pad 1
@@ -158,6 +183,9 @@
 pin19 = MicroBitDigitalPin()        # I2C SCL
 pin20 = MicroBitDigitalPin()        # I2C SDA
 
+pin_logo = MicroBitTouchOnlyPin()   # V2: Touch Logo
+pin_speaker = MicroBitDigitalPin()  # V2: Speaker
+
 ######################################################################
 
 class Image():
@@ -266,3 +294,23 @@
     
     def blit(self, src, x, y, width, height, xdest=0, ydest=0):
         pass
+
+######################################################################
+
+class Sound():
+    GIGGLE = Sound()
+    HAPPY = Sound()
+    HELLO = Sound()
+    MYSTERIOUS = Sound()
+    SAD = Sound()
+    SLIDE = Sound()
+    SOARING = Sound()
+    SPRING = Sound()
+    TWINKLE = Sound()
+    YAWN = Sound()
+
+######################################################################
+
+class SoundEvent():
+    LOUD = SoundEvent('loud')
+    QUIET = SoundEvent('quiet')

eric ide

mercurial