Skip to content

Commit

Permalink
Merge branch 'examples' of github-microbit:microbit-foundation/microp…
Browse files Browse the repository at this point in the history
…ython-microbit-stubs into test
  • Loading branch information
microbit-matt-hillsdon committed May 3, 2022
2 parents 0fe5efd + 92cb638 commit fbcfcff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion typeshed/stdlib/log.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def set_labels(
) -> None:
"""Set up the log file header.
Example: ``log.set_labels("x", "y", "z", log.SECONDS)``
Example: ``log.set_labels('x', 'y', 'z', log.SECONDS)``
Each call to this function with positional arguments will generate a new
header entry into the log file.
Expand Down
24 changes: 12 additions & 12 deletions typeshed/stdlib/microbit/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -142,30 +142,30 @@ class MicroBitDigitalPin:
def read_digital(self) -> int:
"""Get the digital value of the pin.
Example: ``value = pin1.read_digital()``
Example: ``value = pin0.read_digital()``
:return: 1 if the pin is high, and 0 if it's low.
"""
...
def write_digital(self, value: int) -> None:
"""Set the digital value of the pin.
Example: ``pin1.write_digital(1)``
Example: ``pin0.write_digital(1)``
:param value: ``1`` to set the pin high or ``0`` to set the pin low"""
...
def set_pull(self, value: int) -> None:
"""Set the pull state to one of three possible values: ``PULL_UP``, ``PULL_DOWN`` or ``NO_PULL``.
Example: ``pin1.set_pull(pin1.PULL_UP)``
Example: ``pin0.set_pull(pin0.PULL_UP)``
:param value: The pull state from the relevant pin, e.g. ``pin0.PULL_UP``.
"""
...
def get_pull(self) -> int:
"""Get the pull state on a pin.
Example: ``pin1.get_pull()``
Example: ``pin0.get_pull()``
:return: ``NO_PULL``, ``PULL_DOWN``, or ``PULL_UP``
Expand All @@ -176,7 +176,7 @@ class MicroBitDigitalPin:
def get_mode(self) -> str:
"""Returns the pin mode.
Example: ``pin1.get_mode()``
Example: ``pin0.get_mode()``
When a pin is used for a specific function, like
writing a digital value, or reading an analog value, the pin mode
Expand All @@ -188,21 +188,21 @@ class MicroBitDigitalPin:
def write_analog(self, value: int) -> None:
"""Output a PWM signal on the pin, with the duty cycle proportional to ``value``.
Example: ``pin1.write_analog(254)``
Example: ``pin0.write_analog(254)``
:param value: An integer or a floating point number between 0 (0% duty cycle) and 1023 (100% duty).
"""
def set_analog_period(self, period: int) -> None:
"""Set the period of the PWM signal being output to ``period`` in milliseconds.
Example: ``pin1.set_analog_period(10)``
Example: ``pin0.set_analog_period(10)``
:param period: The period in milliseconds with a minimum valid value of 1ms.
"""
def set_analog_period_microseconds(self, period: int) -> None:
"""Set the period of the PWM signal being output to ``period`` in microseconds.
Example: ``pin1.set_analog_period_microseconds(512)``
Example: ``pin0.set_analog_period_microseconds(512)``
:param period: The period in microseconds with a minimum valid value of 256µs.
"""
Expand All @@ -213,7 +213,7 @@ class MicroBitAnalogDigitalPin(MicroBitDigitalPin):
def read_analog(self) -> int:
"""Read the voltage applied to the pin.
Example: ``pin1.read_analog()``
Example: ``pin0.read_analog()``
:return: An integer between 0 (meaning 0V) and 1023 (meaning 3.3V).
"""
Expand All @@ -226,7 +226,7 @@ class MicroBitTouchPin(MicroBitAnalogDigitalPin):
def is_touched(self) -> bool:
"""Check if the pin is being touched.
Example: ``pin1.is_touched()``
Example: ``pin0.is_touched()``
The default touch mode for the pins on the edge connector is `resistive`.
The default for the logo pin **V2** is `capacitive`.
Expand All @@ -249,7 +249,7 @@ class MicroBitTouchPin(MicroBitAnalogDigitalPin):
def set_touch_mode(self, value: int) -> None:
"""Set the touch mode for the pin.
Example: ``pin1.set_touch_mode(pin1.CAPACITIVE)``
Example: ``pin0.set_touch_mode(pin0.CAPACITIVE)``
The default touch mode for the pins on the edge connector is
`resistive`. The default for the logo pin **V2** is `capacitive`.
Expand Down Expand Up @@ -727,7 +727,7 @@ class Image:
def __sub__(self, other: Image) -> Image:
"""Create a new image by subtracting the brightness values of the
other image from this image.
Example: ``Image.HEART - Image.HEART_SMALL``
:param other: The image to subtract.
Expand Down

0 comments on commit fbcfcff

Please sign in to comment.