When I try to compile the following code in Arduino ,I get the error "expected initializer before 'void'".How can I get the code to work?
void setup() {
Serial.begin(9600);
}
float area = 0.0f,pre_area = 0.0f,tarea = 0.0f,rarea = 0.0f;
int x = 0,pre_x = 0,t = 0,pre_t = 0;
long unsigned int t
void loop()
{
x = analogRead(A0);
t = millis();
float diff_t = (float)(t - pre_t)/1000.0f;
area = (0.5 * (pre_x + x) * diff_t) + pre_area;
Serial.print(area);
analogWrite(DAC0, area);
pre_x = x;
pre_area = area;
pre_time = t;
}