Skip to content

Commit 6c3a638

Browse files
committed
pybricks.nxtdevices.UltrasonicSensor: Enable battery power.
This will automatically turn off when unplugged.
1 parent ffecd57 commit 6c3a638

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pybricks/nxtdevices/pb_type_nxtdevices_ultrasonicsensor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static mp_obj_t nxtdevices_UltrasonicSensor_make_new(const mp_obj_type_t *type,
6666
pb_assert(pbio_port_get_i2c_dev(port, &i2c_dev));
6767
assert_i2c_string(i2c_dev, i2c_address, 0x08, "LEGO");
6868
assert_i2c_string(i2c_dev, i2c_address, 0x10, "Sonar");
69-
69+
pbio_port_p1p2_set_power(port, PBIO_PORT_POWER_REQUIREMENTS_BATTERY_VOLTAGE_P1_POS);
7070

7171
nxtdevices_UltrasonicSensor_obj_t *self = mp_obj_malloc(nxtdevices_UltrasonicSensor_obj_t, type);
7272
self->i2c_dev = i2c_dev;

0 commit comments

Comments
 (0)