Using arduino uno, getting error message, seems to be a syntactic error...???
had a couple other drafts, in one I was able to read on my serial monitor "1" for still accelerometer and "11" for moving accelerometer
in another, I was able to read nothing for still accelerometer, and "1" for moving accelerometer
this draft won't compile successfully
I would like it to start at 0 on serial monitor, and increase by one each time accelerometer moves on any of 3 axis
Help is appreciated, go easy on me, im a beginner
this is my code - error message: expected ')' before 'x'
Moderators note : used code tags
had a couple other drafts, in one I was able to read on my serial monitor "1" for still accelerometer and "11" for moving accelerometer
in another, I was able to read nothing for still accelerometer, and "1" for moving accelerometer
this draft won't compile successfully
I would like it to start at 0 on serial monitor, and increase by one each time accelerometer moves on any of 3 axis
Help is appreciated, go easy on me, im a beginner
this is my code - error message: expected ')' before 'x'
C:
const int xpin = A0;
const int ypin = A1;
const int zpin = A2;
int Steps = 0;
int x = 1;
void setup()
{
pinMode (xpin, INPUT);
pinMode (ypin, INPUT);
pinMode (zpin, INPUT);
Serial.begin (9600);
}
void loop()
{
int a = analogRead (xpin);
delay (500);
int b = analogRead (ypin);
delay (500);
int c = analogRead (zpin);
delay (500);
if (a < 678)
{
Serial.print (Steps ++x);
}
if (b <= 464 )
{
Serial.print (Steps ++x);
}
if (c <=4 )
{
Serial.print (Steps ++x);
}
if (a >= 680)
{
Serial.print (Steps ++x);
}
if (b >= 674)
{
Serial.print (Steps ++x);
}
if (c > 6)
{
Serial.print (Steps ++x);
}
}
Last edited by a moderator: