ok
Dependencies: mbed AnalogIn_Diff_ok MovingAverage_ok
main.cpp@0:e08a063f61c3, 2014-12-10 (annotated)
- Committer:
- fblanc
- Date:
- Wed Dec 10 12:53:53 2014 +0000
- Revision:
- 0:e08a063f61c3
- Child:
- 1:868ff3346841
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 | 0:e08a063f61c3 | 21 | |
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 | trms line1_AC(ADC_DIFF(0,1)); |
fblanc | 0:e08a063f61c3 | 28 | line1_AC.test(10); |
fblanc | 0:e08a063f61c3 | 29 | |
fblanc | 0:e08a063f61c3 | 30 | printf("%s %s\r\n",VERSION,CIBLE); |
fblanc | 0:e08a063f61c3 | 31 | |
fblanc | 0:e08a063f61c3 | 32 | line1_AC.set_gain(2.0*ADCVREF/65535.0); |
fblanc | 0:e08a063f61c3 | 33 | line1_AC.set_offset(0.0); |
fblanc | 0:e08a063f61c3 | 34 | line1_AC.start(); |
fblanc | 0:e08a063f61c3 | 35 | while (true) { |
fblanc | 0:e08a063f61c3 | 36 | |
fblanc | 0:e08a063f61c3 | 37 | wait(1.0); |
fblanc | 0:e08a063f61c3 | 38 | printf("Vavg= %f Vrms= %f \r\n",line1_AC.read_average(),line1_AC.read_rms()); |
fblanc | 0:e08a063f61c3 | 39 | //line1_AC.test(20); |
fblanc | 0:e08a063f61c3 | 40 | } |
fblanc | 0:e08a063f61c3 | 41 | } |