Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Go Back   Code Forums > Application and Web Development > Platform/API C++
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 06-09-2005, 06:48 AM   #1 (permalink)
groundfrog
Registered User
 
Join Date: Jun 2005
Posts: 1
groundfrog is on a distinguished road
Hey guys! Code malfunction - need experts workover

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);
__________________

Last edited by redhead : 06-09-2005 at 07:45 AM. Reason: added [code][/code] tags
groundfrog is offline   Reply With Quote
Old 06-09-2005, 07:46 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,680
redhead is on a distinguished road
Moved here, since it's system/API dependent when using _kbhit()
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cisco Code breaking sde Code Newbie News 0 05-21-2004 07:10 AM
An Introduction to XHTML/CSS Rie HTML / CSS 0 03-07-2003 06:50 PM
Hey guys, need a hand with something.. TheX Standard C, C++ 2 06-25-2002 11:20 AM


All times are GMT -8. The time now is 08:47 PM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle