NuMaker ADC read gas sensor (MQ3)

Committer:
SHLIU1@OANBE02333.nuvoton.com
Date:
Wed Feb 24 16:27:23 2021 +0800
Revision:
12:015640054db1
Parent:
4:50241a871e1d
Support the both V5.X and V6.X

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shliu1 4:50241a871e1d 1 # Getting started with ADC on mbed OS
shliu1 4:50241a871e1d 2
shliu1 4:50241a871e1d 3
shliu1 4:50241a871e1d 4 ### Import NuMaker-mbed-ADC0_MQ3 from on-line IDE
shliu1 4:50241a871e1d 5 1. Please choose Nuvoton NuMaker-PFM-XXX as your target platform.
shliu1 4:50241a871e1d 6 2. Please press the left-up icon "New", then choose "NuMaker ADC read gas sensor (MQ3)" from the template list.
shliu1 4:50241a871e1d 7 3. Your NuMaker-mbed-ADC0_MQ3 program is existed.
shliu1 4:50241a871e1d 8
shliu1 4:50241a871e1d 9 #### Now compile
shliu1 4:50241a871e1d 10 Please press compile icon.
shliu1 4:50241a871e1d 11
shliu1 4:50241a871e1d 12 #### Burn Code & Execute
shliu1 4:50241a871e1d 13 1. Connect the board NuMaker-PFM-XXX with your PC by USB cable, then there will be one "mbed" disk.
shliu1 4:50241a871e1d 14 2. Copy the built binary file into "mbed" disk on you PC.
shliu1 4:50241a871e1d 15 3. Press device's reset button and you could get the below log by uart console. UART baud is 9600 at default.
shliu1 4:50241a871e1d 16 -------------------------------------------------------------------------------
shliu1 4:50241a871e1d 17 ADC0 start reading...
shliu1 4:50241a871e1d 18 ADC0 value= 0x 8f0, percentage= 0.098%
shliu1 4:50241a871e1d 19 ADC0 value= 0x1711, percentage= 6.152%
shliu1 4:50241a871e1d 20 :
shliu1 4:50241a871e1d 21 :
shliu1 4:50241a871e1d 22
shliu1 4:50241a871e1d 23 --------------------------------------------------------------------------
shliu1 4:50241a871e1d 24 If the percentage is over than 70.000%, LED will be on. otherwise LED will be off.