Reading ADC value in 3 lines -- Ameba MicroPython

MENG XI

Mar 18, 2020
52
Joined
Mar 18, 2020
Messages
52
RTL8722 from Realtek supports MicroPython and reading ADC values using Python script in 3 lines, here is an example




ADC read potentiometer:
• Materials: Ameba x 1, potentiomete x 1
• Steps:
Here we connect ameba to a potentiometer to measure its analogue value, the connection is as follows.
1.jpg


Copy and paste the following code into REPL.





from machine import ADC



a = ADC(0)



a.read()










 
Values will be obtained and printed on serial terminal once the last line code is executed.


 
Top