myasir786
Newbie level 6
#include <conio.h>
#include <windows.h>
#include<iostream>
using namespace std;
int main()
{
cout<<"Parallel Port Interfacing"<<endl;
cout<<"Press 8 to forw, 2 to reverse,4 to left,6 to right,1 to forw&left and 3 to forw&right:"<<endl;
int inp;
do
{
inp=getch();
out32(0x378,0x00);
if(inp=='8')//D0 forward
{
cout<<"forward";
out32(0x378,0x01);
}
else if(inp=='2')//D1 reverse
{
cout<<"reverse";
out32(0x378,0x02);
}
else if(inp=='4')//D2 left
{
cout<<"left";
out32(0x378,0x04);
}
else if(inp=='6')//D3 right
{
cout<<"right";
out32(0x378,0x08);
}
else if(inp=='1')//D0&D2 forward&left
{
cout<<"forward and left";
out32(0x378,0x05);
}
else if(inp=='3')//D0&D3 forward&right
{
cout<<"forward and right";
out32(0x378,0x09);
}
}
while(inp=='1'||inp=='2'||inp=='3'||inp=='4'||inp=='6'||inp=='8');
system("pause");
return 0;
}
this is the program written by me in dev C++... i want to know that how to declare out32 function for the parallel port i have tried different type or output fuction but none has worked... and i also want to add a condition in my source code that will stop bid just as i leave the button...
actually i want to control a car by parallel port...
#include <windows.h>
#include<iostream>
using namespace std;
int main()
{
cout<<"Parallel Port Interfacing"<<endl;
cout<<"Press 8 to forw, 2 to reverse,4 to left,6 to right,1 to forw&left and 3 to forw&right:"<<endl;
int inp;
do
{
inp=getch();
out32(0x378,0x00);
if(inp=='8')//D0 forward
{
cout<<"forward";
out32(0x378,0x01);
}
else if(inp=='2')//D1 reverse
{
cout<<"reverse";
out32(0x378,0x02);
}
else if(inp=='4')//D2 left
{
cout<<"left";
out32(0x378,0x04);
}
else if(inp=='6')//D3 right
{
cout<<"right";
out32(0x378,0x08);
}
else if(inp=='1')//D0&D2 forward&left
{
cout<<"forward and left";
out32(0x378,0x05);
}
else if(inp=='3')//D0&D3 forward&right
{
cout<<"forward and right";
out32(0x378,0x09);
}
}
while(inp=='1'||inp=='2'||inp=='3'||inp=='4'||inp=='6'||inp=='8');
system("pause");
return 0;
}
this is the program written by me in dev C++... i want to know that how to declare out32 function for the parallel port i have tried different type or output fuction but none has worked... and i also want to add a condition in my source code that will stop bid just as i leave the button...
actually i want to control a car by parallel port...