Hey guys im new here, I have some code I would like you guys to help me fix- this code is for a school assignment and I would like some code experts help.
This code is supposed to tell when you hit the keyboard, and when it is a or s output to the parallel port breadboard. Thanks
Code:
// The includes I will need
#include <iostream.h>
#include <conio.h>
#include <math.h>
#include <stdio.h>
#include <time.h>
//Initiating the voids and void main
void a ();
void s ();
void main ()
{
if (_kbhit())
ch= _getch();
{
if(ch=='a') void a ();
}
{
if(ch=='s') void s ();
}
}
// Gives the user a greeting and gives control instructions
{
printf( "Welcome to the Robot Control Program \n \n") ;
printf( "Press 'a' to use left motor \n") ;
printf( "Press 's' to use right motor \n") ;
printf( "Press 'a' and 's' simultaneously to go forward \n") ;
// Wait loop
{
while ( (!_kbhit()) );
{
}
while (true);
{
while (true)
{
a();
s();
// testing printf("inside loop");
}
}
}
}
// 'a' = left motor on code
void a ()
{
// testing printf( "we are in 'a' \n") ;
char ch;
// testing printf( "we are in 'a' \n") ;
if (_kbhit()) ch= _getch();
if(ch=='a')
{
_outp(0x378,2);
printf( "You have pressed 'a'\n") ;
// testing cout << "You have pressed 'a' \n";
}
}
// 's' = right motor on code
void s ()
{
// testing printf( "we are in 's' \n") ;
char ch;
// testing printf( "we are in 's' \n") ;
if (_kbhit()) ch= _getch();
if(ch=='s')
{
_outp(0x378,3);
printf( "You have pressed 's' \n") ;
// testing cout << "You have pressed 's' \n";
}
}
// TEST CODE - printf("%c",ch);