Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

c programming for robot please check

Status
Not open for further replies.

vead

Full Member level 5
Joined
Nov 27, 2011
Messages
285
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
india
Activity points
3,815
hi,
i am trying to write c code please check me

The robot move over pipe. The IR sensor is used to sense The pipe when infrared signal fall on white surface its gets reflected and if it fall on black surface it is not reflected


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include<pic.h>
#define sensor_3
#define motor1_4
#define motor2_5
main()
{
 if(sensor==1);                      //sensor on
   {
    (motor1=motor2=1);           //motor run forward
    }
if (sensor==0);                      //sensor off
   {
   (motor1=motor2=0);            //motor stop
    }
}

 
Last edited by a moderator:

hi

first of all you have to configure the port pins as input and output accordingly
you must use a while loop to work the system if you want to run it for ever.
this is what i feel went wrong in the code

ml
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top