hi
thank you, the code did work.
now actually am trying to design an autonomous vehicle that when detects obstacle will avoid collision by changing its direction. for the purpose am using an OOPic-R controller, the IRPD sensor, and XDDCMD DC motor driver.
could you please help me in writing the code for it.
i have written one but i need your help just have a look at it
oIRPD A = New oIRPD;
oDCMotor ML = New oDCMotor(18,26,27,0,cvOff,100,cvOn);
oDCMotor MR = New oDCMotor(17,24,25,0,cvOff,100,cvOn);
oWire WL = New oWire;
oWire2 WC = New oWire2;
oWire WR = New oWire;
Void main(Void) {
A.IOLineL = 30;
A.IOLineS = 28;
A.IOLineR = 29;
A.Operate = 1;
WL.Input.Link (A.Left);
WL.Output.Link (MR.Direction);
WL.Operate = 1;
If (MR.Direction==1)
{
For(MR=100;MR>10;MR=MR-10){
ooPIC.Delay = 2;
}
For(MR=10;MR<100;MR=MR+10){
ooPIC.Delay = 2;
}
}
WR.Input.Link (A.Right);
WR.Output.Link (ML.Direction);
WR.Operate = 1;
If (ML.Direction==1)
{
For(ML=100;ML>10;ML=ML-10){
ooPIC.Delay = 2;
}
For(ML=10;ML<100;ML=ML+10){
ooPIC.Delay = 2;
}
}
WC.Input.Link (A.Center);
WC.Output1.Link (MR.Brake);
WC.Output2.Link (ML.Brake);
WC.Operate = 1;
}
i have written the code such that when obstacle is detected on the left the vehicle will turn right and if obstacle is on the right the vehicle will take a left turn and if obstacle is at the center the vehicle stops.
well… i have got another trouble, i need a 12volts battery to run the LMD18200 H-Bridge and am given the battery used in car or bikes but if i use that battery my vehicle cannot move because the battery is very heavy.
can i find a 12volts battery of less weight, with good lifetime and economical?
also will u please tell me the specifications of the motor i should use for this project . i am presently using a motor obtained from my uncle’s garage i have no idea of its voltage ratings nothing. am using it just for testing.
i was thinking a brushed DC motor of 12volts 150rpm would do. what would you suggest?