NadaF
Newbie level 6
- Joined
- May 1, 2013
- Messages
- 13
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,364
hi, i need help my project is taking about auto drive system, i'm using 4 ping sensor HC-SR04 and microcontroller pic 16f877a, and i have a problem with MikroC code, for calculating duration and i will use this rule to calculate the distance: (duration/29.1) / 2
i have written this code and i hope anyone to help me plz
TRISB.f1=0; // trigpin is low i/p
TRISB.f0=1; // echopin high o/p
TRISB.f1=1; // trigpin high
delay_us(10); // wait 10
duration = pulseIn(4, HIGH);
distance = (duration/29.1) / 2;
if (distance <= 400);
--> what should i write here?
delay_us(100);
}
}
i have written this code and i hope anyone to help me plz
TRISB.f1=0; // trigpin is low i/p
TRISB.f0=1; // echopin high o/p
TRISB.f1=1; // trigpin high
delay_us(10); // wait 10
duration = pulseIn(4, HIGH);
distance = (duration/29.1) / 2;
if (distance <= 400);
--> what should i write here?
delay_us(100);
}
}