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
Fork of Low_Cost_PWM by
Multiplex.cpp
- Committer:
- Racer01014
- Date:
- 2014-09-10
- Revision:
- 6:f97371e6bc3e
- Parent:
- 4:1dc83796f66f
File content as of revision 6:f97371e6bc3e:
#include "mbed.h"
float Temperatur_1 = 0, Temperatur_2 = 0, Temperatur_3 = 0, Aux = 0;
float Motorspannung = 0, Motorstrom = 0, Bremsenspannung = 0, Bremsenstrom = 0;
void read_sensors(void)
{
int Messwert_0 = 0, Messwert_1 = 0;
Multiplex_select_0 = 0, Multiplex_select_1 = 0;
//Selection of Multiplexer states
for (int i=0; i<=4; i++) {
Multiplex_select_0 = i&0x01;
Multiplex_select_1 = (i>>1)&0x01;
wait(0.001);
Messwert_0 = Messkanal_0.read_u16();
Messwert_1 = Messkanal_1.read_u16();
switch(i) {
case 0: {
Temperatur_1 = Messwert_0 ;
Motorspannung = Messwert_1 * 0.000515 - 0.05 ; //Gute Näherung von 2- ~23V. Dannach zu niedrig.Z-Diode
break;
}
case 1: {
Temperatur_2 = Messwert_0 ;
Motorstrom = Messwert_1 * 0.000396 - 4.15;//
break;
}
case 2: {
Temperatur_3 = Messwert_0;
Bremsenspannung = Messwert_1 * 0.000515 - 0.05;//Gute Näherung von 2- ~23V. Dannach zu niedrig.Z-Diode
break;
}
case 3: {
Aux = Messwert_0 / 1629;
Bremsenstrom = Messwert_1; //* 0.00032 - 15.8;
break;
}
}
}
}
