test AnalogIn_Diff.lib for board K64F
Dependencies: AnalogIn_Diff_ok mbed
main.cpp@10:fa287cb0f603, 2016-01-08 (annotated)
- Committer:
- fblanc
- Date:
- Fri Jan 08 08:39:58 2016 +0000
- Revision:
- 10:fa287cb0f603
- Parent:
- 9:a9a333f3e760
date ok
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fblanc | 8:1aae5c9ae98f | 1 | /* |
fblanc | 8:1aae5c9ae98f | 2 | * Copyright (c) 2014 LAAS-CNRS |
fblanc | 8:1aae5c9ae98f | 3 | * |
fblanc | 8:1aae5c9ae98f | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
fblanc | 8:1aae5c9ae98f | 5 | * you may not use this file except in compliance with the License. |
fblanc | 8:1aae5c9ae98f | 6 | * You may obtain a copy of the License at |
fblanc | 8:1aae5c9ae98f | 7 | * |
fblanc | 8:1aae5c9ae98f | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
fblanc | 8:1aae5c9ae98f | 9 | * |
fblanc | 8:1aae5c9ae98f | 10 | * Unless required by applicable law or agreed to in writing, software |
fblanc | 8:1aae5c9ae98f | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
fblanc | 8:1aae5c9ae98f | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
fblanc | 8:1aae5c9ae98f | 13 | * See the License for the specific language governing permissions and |
fblanc | 8:1aae5c9ae98f | 14 | * limitations under the License. |
fblanc | 8:1aae5c9ae98f | 15 | */ |
fblanc | 0:9eeda5b17b5b | 16 | #include "mbed.h" |
fblanc | 4:bcd2a4b5feaf | 17 | #include "AnalogIn_Diff.h" |
fblanc | 4:bcd2a4b5feaf | 18 | |
fblanc | 10:fa287cb0f603 | 19 | #define VERSION "AnalogIn_Diff_helloworld_2016_01_08" |
fblanc | 2:bf4f474ff746 | 20 | #define CIBLE "K64F" |
fblanc | 0:9eeda5b17b5b | 21 | Serial pc(USBTX, USBRX); |
fblanc | 9:a9a333f3e760 | 22 | AnalogIn_Diff adc_diff(ADC_DIFF(0,1)); |
fblanc | 0:9eeda5b17b5b | 23 | Ticker flipperADC; |
fblanc | 8:1aae5c9ae98f | 24 | bool flag_TX=false; |
fblanc | 1:c340607e4661 | 25 | void flipADC() |
fblanc | 1:c340607e4661 | 26 | { |
fblanc | 8:1aae5c9ae98f | 27 | flag_TX=true; |
fblanc | 5:f994e394a7ec | 28 | } |
fblanc | 1:c340607e4661 | 29 | int main() |
fblanc | 1:c340607e4661 | 30 | { |
fblanc | 9:a9a333f3e760 | 31 | pc.baud(115200); |
fblanc | 8:1aae5c9ae98f | 32 | pc.printf("%s %s\r\n",VERSION,CIBLE); |
fblanc | 8:1aae5c9ae98f | 33 | flipperADC.attach(&flipADC, 1.0); |
fblanc | 9:a9a333f3e760 | 34 | |
fblanc | 0:9eeda5b17b5b | 35 | while (true) { |
fblanc | 8:1aae5c9ae98f | 36 | if(flag_TX) { |
fblanc | 9:a9a333f3e760 | 37 | pc.printf("V= %f raw=%d\r\n",adc_diff.read()*6.6,adc_diff.read_raws16()); |
fblanc | 8:1aae5c9ae98f | 38 | flag_TX=false; |
fblanc | 8:1aae5c9ae98f | 39 | } |
fblanc | 0:9eeda5b17b5b | 40 | } |
fblanc | 0:9eeda5b17b5b | 41 | } |