Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5190

General • Re: Help with Pico ADC project

$
0
0
Thanks, but I dont see any OUTPUT defined in that code.


It looks like that is YOUR code. You haven't defined any output.



This little MicroPython demo might give you inspiration -

Code:

#print("LED trigger demo for deanfourie1")from machine import Pinimport timeled16 = Pin(16, Pin.OUT)trigger_threshold = 1.65def trigger_led(my_led, current_value):    print(f"Setting led from value {current_value}")    if(current_value >= trigger_threshold):        my_led.on()        print("LED ON")    else:        my_led.off()        print("LED OFF")    time.sleep(0.5)print("LED trigger demo for deanfourie1")trigger_led(led16, 0.0)trigger_led(led16, 0.1)trigger_led(led16, 1.4)trigger_led(led16, 1.6)trigger_led(led16, 1.65)trigger_led(led16, 1.7)trigger_led(led16, 1.9)trigger_led(led16, 3.2)trigger_led(led16, 3.3)print("Demo finished.")

You might need to adjust the Pin being used to connect the LED and the threshold used for triggering the LED.

Derived from this MicroPython documentation:
Ref: Pins and GPIO - https://docs.micropython.org/en/latest/ ... s-and-gpio

Statistics: Posted by B.Goode — Mon Jun 17, 2024 11:08 am



Viewing all articles
Browse latest Browse all 5190

Trending Articles