Hello guys....their is problem with the programming...so i need help in this. the code i have written is pasted below. this program is for the project accelerometer based hand gesture controlled robot.
#include<reg52.h>int i;void main(void){
P0=0xFF;/*initialise P0 as input for sensor*/for(i=0;i<10000;i++)while(1){switch(P0)/*check status of port P0*/{case(0xF5):
P3=0xFA;/*forward*/for(i=0;i<30000;i++)break;case(0xFA):
P3=0xF5;/*reverse*/for(i=0;i<30000;i++)break;case(0xF6):
P3=0xF8;/*right*/for(i=0;i<30000;i++)break;case(0XF9):
P3=0xF2;/*left*/for(i=0;i<30000;i++)break;}}}
If those 'for' loops are meant to be delay loops they need a semicolon after each one.
for(i=0;i<30000;i++);
Right now you are breaking out of the switch statement on the first time through, and not executing the loops.
It would be helpful if you would provide slightly more context for your project. I am having to assume a number of things, not to mention you haven't actually told us what is not working.
i am trying to write program...which can do tasks..like taking input from port 0(4 bit) and accordingly send 4 bit data on the port3 to the motors(2 motors). sensor used is adxl 335.