I have an 2 analog signal, and I want to calculate the difference between 2 signals (A0 and A1), then integrate an analog, but it doesn't work (I just started studying Arduino).
Please could you show me how to deal with this problem?
Thanks a lot
float analogInPin = A0;
float analogInPin1 = A1;
float analogOutPin = DAC1;
float FeqIn, FeqIn1, FeqIn2, FeqIn3, FeqOut, w, Triarea, Recarea, area, n, y, t;
void setup() {
Serial.begin(9600); // use the serial port
}
void loop() {
FeqIn1 = analogRead(analogInPin);
FeqIn2 = analogRead(analogInPin1);
FeqIn3 = FeqIn1 - FeqIn2
// integration
area(1) = 0;
y(1) = 0;
for (n = 1; n = t; t++) {
Triarea(n+1) = (0.5*t(2))*(FeqIn3(n+1) - FeqIn3(n));
Recarea(n+1) = t(2)*(FeqIn3(n));
area(n+1) = (Triarea(n+1) + Recarea(n+1)) + area(n);
}
}
The error message is:
Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
_02.ino:3: error: 'DAC1' was not declared in this scope
_02.ino.ino: In function 'void loop()':
_02.ino:20: error: expected ';' before 'area'
_02.ino:21: error: 'y' cannot be used as a function
_02.ino:24: error: 'Triarea' cannot be used as a function
_02.ino:24: error: 't' cannot be used as a function
_02.ino:24: error: 'FeqIn3' cannot be used as a function
_02.ino:24: error: 'FeqIn3' cannot be used as a function
_02.ino:25: error: 'Recarea' cannot be used as a function
_02.ino:25: error: 't' cannot be used as a function
_02.ino:25: error: 'FeqIn3' cannot be used as a function
_02.ino:26: error: 'area' cannot be used as a function
_02.ino:26: error: 'Triarea' cannot be used as a function
_02.ino:26: error: 'Recarea' cannot be used as a function
_02.ino:26: error: 'area' cannot be used as a function
'DAC1' was not declared in this scope
area(1) = 0;
- what is that supposed to be doing? – Nick Gammon Aug 18 at 8:45