This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from microbit import uart, pin14, pin15, sleep | |
from sys import print_exception | |
class US100: | |
def __init__(self, tpin=pin15, rpin=pin14): | |
self.tx_pin = tpin | |
self.rx_pin = rpin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from microbit import spi | |
from microbit import pin13, pin14, pin15 | |
class HCSR04: | |
def __init__(self, tpin=pin15, epin=pin14, spin=pin13): | |
self.trigger_pin = tpin | |
self.echo_pin = epin | |
self.sclk_pin = spin |