Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Messdatenerfassung.cpp
- Revision:
- 7:ed9a83df000a
- Parent:
- 5:d213c03872fe
- Child:
- 8:fb6cb712eb52
--- a/Messdatenerfassung.cpp Tue May 19 15:14:50 2015 +0000 +++ b/Messdatenerfassung.cpp Tue May 19 15:49:46 2015 +0000 @@ -1,28 +1,36 @@ #include "mbed.h" -AnalogIn analog_value(A0); - int test(){ - - - - - - } - -float hall_umrechnung() -{ - float meas0; - meas0 = analog_value0.read() - 0.27; - if(meas0 < 0) - { - meas0 = 0; + +AnalogIn voltage0(A0); // Edit Pin-Port for the accu-voltage measurement +AnalogIn voltage1(A1); // Edit Pin-Port for the throttle-voltage measurement +AnalogIn voltage2(A2); // Edit Pin-Port for the capacitor-voltage measurement + +float Accu_Voltage(){ + + float meas0; + meas0 = voltage0.read(); // read adc value + return meas0; // return value } - meas0 = meas0*2; +float hall_umrechnung(){ + float meas0; + meas0 = voltage1read() - 0.27; // read adc and rearange the voltage_value,because its 0.27 when the throttle is off + + if(meas0 < 0){ // meas0 isnt allowed to be <0 because its sets the pulsewidht of the pwm + meas0 = 0; + } - if(meas0 > 1) - { + meas0 = meas0*2; // creates values between 0 and 1 + + if(meas0 > 1){ // meas0 isnt allowed to be >1 because its sets the pulsewidth of the pwm meas0 = 1; + } + + return meas0; // return value } - return meas0; -} \ No newline at end of file +float Capacitor_Voltage(){ + + float meas0; + meas0 = avoltage2.read(); //read adc value + return meas0; // return value + }