Trying to code a function to read the ADCs on my PICO W using the latest uPython version and also the latest Thonny IDE version.
this is the code for the function:
def getADCvalue(ADCchannel):
value = 0
match ADCchannel:
case 0:
value = machine.ADC(26).read_U16()
case 1:
value = machine.ADC(27).read_U16()
case 2:
value = machine.ADC(28).read_U16()
return value
this is not about the ADC read is more about the Pithon syntax. is the first time I'm using the match case syntax and can't really get what the issue is, this is the error I get:
Traceback (most recent call last): File "", line 55 SyntaxError: invalid syntax
that is the line for the match ADCchannel:
not sure what is complaining about... I pass a integer parameter defining which ADC I want to read and then depending on the case statement trigger read the ADC.
any thoughts will be apreciated.
Best Regards EngineBeat.