ok
Dependencies: mbed AnalogIn_Diff_ok MovingAverage_ok
main.cpp@1:868ff3346841, 2016-01-08 (annotated)
- Committer:
- fblanc
- Date:
- Fri Jan 08 08:09:28 2016 +0000
- Revision:
- 1:868ff3346841
- Parent:
- 0:e08a063f61c3
- Child:
- 3:735c712ffaee
ok
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fblanc | 0:e08a063f61c3 | 1 | /* |
fblanc | 0:e08a063f61c3 | 2 | * Copyright (c) 2014 LAAS-CNRS |
fblanc | 0:e08a063f61c3 | 3 | * |
fblanc | 0:e08a063f61c3 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
fblanc | 0:e08a063f61c3 | 5 | * you may not use this file except in compliance with the License. |
fblanc | 0:e08a063f61c3 | 6 | * You may obtain a copy of the License at |
fblanc | 0:e08a063f61c3 | 7 | * |
fblanc | 0:e08a063f61c3 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
fblanc | 0:e08a063f61c3 | 9 | * |
fblanc | 0:e08a063f61c3 | 10 | * Unless required by applicable law or agreed to in writing, software |
fblanc | 0:e08a063f61c3 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
fblanc | 0:e08a063f61c3 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
fblanc | 0:e08a063f61c3 | 13 | * See the License for the specific language governing permissions and |
fblanc | 0:e08a063f61c3 | 14 | * limitations under the License. |
fblanc | 0:e08a063f61c3 | 15 | */ |
fblanc | 0:e08a063f61c3 | 16 | #include "mbed.h" |
fblanc | 0:e08a063f61c3 | 17 | #include "trms.h" |
fblanc | 0:e08a063f61c3 | 18 | |
fblanc | 0:e08a063f61c3 | 19 | #define VERSION "trms_helloworld_2014_12_08" |
fblanc | 0:e08a063f61c3 | 20 | #define CIBLE "K64F" |
fblanc | 1:868ff3346841 | 21 | Serial pc(USBTX, USBRX); // tx, rx |
fblanc | 0:e08a063f61c3 | 22 | |
fblanc | 0:e08a063f61c3 | 23 | |
fblanc | 0:e08a063f61c3 | 24 | int main() |
fblanc | 0:e08a063f61c3 | 25 | { |
fblanc | 0:e08a063f61c3 | 26 | |
fblanc | 0:e08a063f61c3 | 27 | |
fblanc | 1:868ff3346841 | 28 | pc.baud(115200); |
fblanc | 1:868ff3346841 | 29 | trms line1_AC(ADC_DIFF(0,1)); |
fblanc | 1:868ff3346841 | 30 | pc.printf("%s %s\r\n",VERSION,CIBLE); |
fblanc | 1:868ff3346841 | 31 | |
fblanc | 1:868ff3346841 | 32 | line1_AC.set_gain(GAIN); |
fblanc | 0:e08a063f61c3 | 33 | line1_AC.set_offset(0.0); |
fblanc | 0:e08a063f61c3 | 34 | line1_AC.start(); |
fblanc | 1:868ff3346841 | 35 | int i=0; |
fblanc | 1:868ff3346841 | 36 | while (++i<=1000) { |
fblanc | 1:868ff3346841 | 37 | wait(0.1); |
fblanc | 1:868ff3346841 | 38 | pc.printf("%f\t%f\r\n",line1_AC.read_average(),line1_AC.read_rms()); |
fblanc | 0:e08a063f61c3 | 39 | } |
fblanc | 0:e08a063f61c3 | 40 | } |