Skip to content

Commit c8cbe78

Browse files
committed
Update example
1 parent 0291969 commit c8cbe78

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

example/adc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
last_duty = -1
2020
while True:
2121
# Read ADC voltage value
22-
voltage = adc.read_uv() / 1000000
22+
voltage = adc.read_u16() / 10000
2323

2424
# Ensure voltage is within valid range
2525
if voltage < MIN_VOLTAGE:

example/battery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
adc = XiaoADC(adc)
1313
while True:
1414
# Read the battery voltage in microvolts and convert to volts
15-
vbat = adc.read_uv() / 1000000
15+
vbat = adc.read_u16() / 10000
1616
print("Battery Voltage: {:.4f} V".format(vbat))
1717
time.sleep(0.1)
1818
except KeyboardInterrupt:

0 commit comments

Comments
 (0)