Skip to content

Commit b8f4bd3

Browse files
authored
Merge pull request #966 from pimoroni/examples-fix-adc
Examples: Update ADC()
2 parents 9c7ecdc + b5d496b commit b8f4bd3

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

micropython/examples/pico_lipo_shim/battery_pico.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
display.set_backlight(0.8)
1414

15-
vsys = ADC(29) # reads the system input voltage
15+
vsys = ADC(Pin(29)) # reads the system input voltage
1616
charging = Pin(24, Pin.IN) # reading GP24 tells us whether or not USB power is connected
1717
conversion_factor = 3 * 3.3 / 65535
1818

micropython/examples/pimoroni_pico_lipo/battery_pico_display.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
display.set_backlight(0.8)
1515

16-
vsys = ADC(29) # reads the system input voltage
16+
vsys = ADC(Pin(29)) # reads the system input voltage
1717
charging = Pin(24, Pin.IN) # reading GP24 tells us whether or not USB power is connected
1818
conversion_factor = 3 * 3.3 / 65535
1919

micropython/examples/pimoroni_pico_lipo/battery_pico_explorer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
buzzer = Buzzer(0)
1515

16-
vsys = ADC(29) # reads the system input voltage
16+
vsys = ADC(Pin(29)) # reads the system input voltage
1717
charging = Pin(24, Pin.IN) # reading GP24 tells us whether or not USB power is connected
1818
conversion_factor = 3 * 3.3 / 65535
1919

micropython/examples/tufty2040/autobright.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
button_b = Button(8, invert=False)
3333
# Pins and analogue-digital converters we need to set up to measure sensors.
3434
lux_vref_pwr = Pin(27, Pin.OUT)
35-
lux = ADC(26)
36-
vbat_adc = ADC(29)
37-
vref_adc = ADC(28)
35+
lux = ADC(Pin(26))
36+
vbat_adc = ADC(Pin(29))
37+
vref_adc = ADC(Pin(28))
3838
usb_power = Pin(24, Pin.IN)
3939

4040
display = PicoGraphics(display=DISPLAY_TUFTY_2040)

micropython/examples/tufty2040/battery.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
display.set_backlight(0.8)
1111

1212
# set up the ADCs for measuring battery voltage
13-
vbat_adc = ADC(29)
14-
vref_adc = ADC(28)
13+
vbat_adc = ADC(Pin(29))
14+
vref_adc = ADC(Pin(28))
1515
vref_en = Pin(27)
1616
vref_en.init(Pin.OUT)
1717
vref_en.value(0)

0 commit comments

Comments
 (0)