test AnalogIn_Diff.lib for board K64F
Dependencies: AnalogIn_Diff_ok mbed
main.cpp@8:1aae5c9ae98f, 2014-12-05 (annotated)
- Committer:
- fblanc
- Date:
- Fri Dec 05 15:46:02 2014 +0000
- Revision:
- 8:1aae5c9ae98f
- Parent:
- 7:e1a6763c6da2
- Child:
- 9:a9a333f3e760
test AnalogIn_Diff.lib
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 | 8:1aae5c9ae98f | 19 | #define VERSION "AnalogIn_Diff_helloworld_2014_12_02" |
fblanc | 2:bf4f474ff746 | 20 | #define CIBLE "K64F" |
fblanc | 0:9eeda5b17b5b | 21 | Serial pc(USBTX, USBRX); |
fblanc | 0:9eeda5b17b5b | 22 | Ticker flipperADC; |
fblanc | 8:1aae5c9ae98f | 23 | bool flag_TX=false; |
fblanc | 1:c340607e4661 | 24 | void flipADC() |
fblanc | 1:c340607e4661 | 25 | { |
fblanc | 8:1aae5c9ae98f | 26 | flag_TX=true; |
fblanc | 5:f994e394a7ec | 27 | } |
fblanc | 1:c340607e4661 | 28 | int main() |
fblanc | 1:c340607e4661 | 29 | { |
fblanc | 8:1aae5c9ae98f | 30 | pc.printf("%s %s\r\n",VERSION,CIBLE); |
fblanc | 8:1aae5c9ae98f | 31 | flipperADC.attach(&flipADC, 1.0); |
fblanc | 8:1aae5c9ae98f | 32 | AnalogIn_Diff adc_diff(ADC_DIFF(0,1)); |
fblanc | 0:9eeda5b17b5b | 33 | while (true) { |
fblanc | 8:1aae5c9ae98f | 34 | if(flag_TX) { |
fblanc | 8:1aae5c9ae98f | 35 | pc.printf("V= %f \r\n",adc_diff.read()*6.6); |
fblanc | 8:1aae5c9ae98f | 36 | flag_TX=false; |
fblanc | 8:1aae5c9ae98f | 37 | } |
fblanc | 0:9eeda5b17b5b | 38 | } |
fblanc | 0:9eeda5b17b5b | 39 | } |