|
10 | 10 | #define dataLinkRX 3 |
11 | 11 | #define dataLinkTX 4 |
12 | 12 |
|
13 | | - |
14 | | - |
15 | | -// analog multiplexer control signals |
16 | | -#define analogMuxS0 5 |
17 | | -#define analogMuxS1 6 |
18 | | -#define analogMuxS2 7 |
19 | | - |
20 | | -// analog multiplexer enable signal |
21 | | -#define analogMuxE 8 |
22 | | - |
23 | | -// analog multiplexer data |
24 | | -#define analogMuxData A5 |
25 | | - |
26 | | - |
27 | 13 | #define currentPhase1Pin A0 |
28 | 14 | #define currentPhase2Pin A1 |
29 | 15 | #define currentPhase3Pin A2 |
30 | | -#define flowCurrrentPin 0 // analog mux pin |
31 | | -#define busVoltagePin 1 // analog mux pin |
| 16 | +// #define flowCurrrentPin A5 |
| 17 | +#define busVoltagePin A5 |
32 | 18 |
|
33 | 19 | #define flowSensorInterrupt 0 // 0 = digital pin 2 |
34 | 20 |
|
@@ -172,11 +158,11 @@ boolean readSensorData() { |
172 | 158 | break; |
173 | 159 | case 3: |
174 | 160 | // BUS Spannung |
175 | | - sensorValue = (float)read4051AnalogPin(busVoltagePin); |
| 161 | + sensorValue = (float)analogRead(busVoltagePin); |
176 | 162 | break; |
177 | 163 | case 4: |
178 | 164 | // Current Primary |
179 | | - sensorValue = (float)read4051AnalogPin(flowCurrrentPin); |
| 165 | + sensorValue = 0; // (float)analogRead(flowCurrrentPin); |
180 | 166 | break; |
181 | 167 | case 5: |
182 | 168 | // Temp PFC |
@@ -289,22 +275,3 @@ float measureCurrent(byte analogPin) { // analogPin [0..7] |
289 | 275 | } |
290 | 276 | return 0; |
291 | 277 | } |
292 | | - |
293 | | -int read4051AnalogPin(int pin) { |
294 | | - // select multiplexer input |
295 | | - digitalWrite(analogMuxS0, pin & 1); |
296 | | - digitalWrite(analogMuxS1, pin & 2 >> 1); |
297 | | - digitalWrite(analogMuxS2, pin & 4 >> 2); |
298 | | - |
299 | | - // enable |
300 | | - digitalWrite(analogMuxE, LOW); |
301 | | - delayMicroseconds(5); |
302 | | - |
303 | | - // read value |
304 | | - int val = analogRead(analogMuxData); |
305 | | - |
306 | | - // disable |
307 | | - digitalWrite(analogMuxE, HIGH); |
308 | | - |
309 | | - return val; |
310 | | -} |
0 commit comments