i m new to arduino. i am doing blind navigation projects.for that i am using one ultrasonic sensor arduino,vibrators and buzzer.our tool need to detect 5 obstacles (pit, staircase,lamp post,tree,wall ).i did
program for tat except staircase.bt i m getting oscillating output and too i need too differntiate wall and lamp post.for that i made some changes in program,it correctly says wall but floor (ground)also it detect as wall.can u plz help me and correct my code.main things i need to detect pit and obstacles correctly.
can u ppl help me out to elevate my projects?
Yes. It is shorthand for "sensorcount = sensorcount + 1;". It can also be written "sensorcount += 1;" or "sensorcount++".
When used inside an expression the ++ and -- operators work differently depending on which side of the variable they are on:
int a = 1;
int b = ++a; // Sets a and b to 2
int c = a++; // Sets c to 2 (the old value of a) and sets a to 3.
int d = --a; // Sets a and d to 2.
int e = a--; // Sets e to 2 (the old value of a) and sets a to 1
int b = ++a; // Sets a and b to 2
int c = a++; // Sets c to 2 (the old value of a) and sets a to 3.
int d = --a; // Sets a and d to 2.
int e = a--; // Sets e to 2 (the old value of a) and sets a to 1
Thanks for it..
johnwasser:
When used inside an expression the ++ and -- operators work differently depending on which side of the variable they are on:
the code is explaining well But... Can anyone explain it..
x = ++a => the ++ is on the left so it is applied before a is assigned to x (pre-increment)
x = a++ ==> the ++ is on the right so it is applied after a is assigned to x (post increment)
Never use these pre-post increment in function calls or even worse macros, as the code is hard to understand.
int sum(int a, int b) { return a + b} ;
x = 2;
z = 3;
y = sum(x++, ++z); // y = 6;
#define square(x) ((x)*(x))
a = 4;
y = square(a++); // y becomes 30 ... if you can figure out why, you understand why you should not use this.
k.thnks a lot.is there any mistake in the pit and obstacles detection?sometime it is showing the correct output but sometime i am getting oscillation in the output?is there any way to find the obstacles and pit in a correct manner(without calculating threshold)?
Can you tell me how you considered those thresholds for wall, staircase and pit?? how did you differentiate it?? I need it for my project. Can you help me?