Jump to content
Electronics-Lab.com Community

Reading ADC value in 3 lines -- Ameba MicroPython


Recommended Posts

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

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.
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
  • Create New...