Ray Liu
/
NuMaker-mbed-ADC0_MQ3
Modify the file main.cpp for M487
README.md@0:9a9104a3d71f, 2017-09-29 (annotated)
- Committer:
- shliu1
- Date:
- Fri Sep 29 05:41:53 2017 +0000
- Revision:
- 0:9a9104a3d71f
main.cpp adds the setting of TARGET_NUMAKER_PFM_M487 for M487
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shliu1 | 0:9a9104a3d71f | 1 | # Getting started with ADC on mbed OS |
shliu1 | 0:9a9104a3d71f | 2 | |
shliu1 | 0:9a9104a3d71f | 3 | |
shliu1 | 0:9a9104a3d71f | 4 | ### Import NuMaker-mbed-ADC0_MQ3 from on-line IDE |
shliu1 | 0:9a9104a3d71f | 5 | 1. Please choose Nuvoton NuMaker-PFM-XXX as your target platform. |
shliu1 | 0:9a9104a3d71f | 6 | 2. Please press the left-up icon "New", then choose "NuMaker ADC read gas sensor (MQ3)" from the template list. |
shliu1 | 0:9a9104a3d71f | 7 | 3. Your NuMaker-mbed-ADC0_MQ3 program is existed. |
shliu1 | 0:9a9104a3d71f | 8 | |
shliu1 | 0:9a9104a3d71f | 9 | #### Now compile |
shliu1 | 0:9a9104a3d71f | 10 | Please press compile icon. |
shliu1 | 0:9a9104a3d71f | 11 | |
shliu1 | 0:9a9104a3d71f | 12 | #### Burn Code & Execute |
shliu1 | 0:9a9104a3d71f | 13 | 1. Connect the board NuMaker-PFM-XXX with your PC by USB cable, then there will be one "mbed" disk. |
shliu1 | 0:9a9104a3d71f | 14 | 2. Copy the built binary file into "mbed" disk on you PC. |
shliu1 | 0:9a9104a3d71f | 15 | 3. Press device's reset button and you could get the below log by uart console. UART baud is 9600 at default. |
shliu1 | 0:9a9104a3d71f | 16 | ------------------------------------------------------------------------------- |
shliu1 | 0:9a9104a3d71f | 17 | ADC0 start reading... |
shliu1 | 0:9a9104a3d71f | 18 | ADC0 value= 0x 8f0, percentage= 0.098% |
shliu1 | 0:9a9104a3d71f | 19 | ADC0 value= 0x1711, percentage= 6.152% |
shliu1 | 0:9a9104a3d71f | 20 | : |
shliu1 | 0:9a9104a3d71f | 21 | : |
shliu1 | 0:9a9104a3d71f | 22 | |
shliu1 | 0:9a9104a3d71f | 23 | -------------------------------------------------------------------------- |
shliu1 | 0:9a9104a3d71f | 24 | If the percentage is over than 70.000%, LED will be on. otherwise LED will be off. |