Replies: 1 comment 2 replies
-
|
Nice! Did you implement it in Python? The following pattern is quite convenient: class MyUltrasonic:
def __init__(self):
self.i2c = I2CDevice(Port.S4, address=0x01)
def distance(self):
return self.i2c.read(0x42, 1, lambda data: data[0] * 10)
sensor = MyUltrasonic()In this example, the distance method is provided to the user. It will read from 0x42, get one byte, and convert it to useful number. This way, it will work with async/await too without any special additions. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I’ve set about implementing the HiTec ColorSensor V2 for pyBricks and EV3. 🤠
It works well – and, of course, in the usual output format;
Color.BLACK
Color.GREEN
Color.YELLOW
Color.RED
Color.BLUE
Color.WHITE
Are there any other enthusiasts here who’d like to try using the HiTec ColorSensor V2?
Then make yourself known!
Beta Was this translation helpful? Give feedback.
All reactions