|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#11
|
||||
|
||||
|
Re: Does reading from the serial port work?
Code:
for ( x = 0 ; byteswaiting == x ; x++ ) In PrintToScreen %d does expect a integer, I've never had a issue using %d with int or char without casting data types. I have have had problems with mixing data types for instance %ld with a int or %d with long. My function is in main() because that was the only function of the whole program. I wrote it in VEX without a competition template in FRC it's called a Standalone Project in the File menu. I had a hard time making it work and Brad sent me a program like a year ago to me and this is how it worked for the most part. 1.) Call GetSerialPort1ByteCount( ) to see if there are any bytes waiting in the buffer. Code:
byteswaiting = GetSerialPort1ByteCount( );
if ( byteswaiting != 0 )
or single variable Code:
for ( x = 0 ; byteswaiting == x ; x++ )
{
byte = ReadSerialPortOne( );
3.) Do as you will with the data you just received In this case check for return or print the ASCII code for the keypressed Last edited by Kingofl337 : 25-01-2008 at 14:29. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| No Serial Port | G1279 | Programming | 5 | 10-01-2008 15:15 |
| Programming the vex microcontroller to respond to commands on the serial port | crashoverride02 | Programming | 1 | 20-10-2006 14:17 |
| Scripting Setup and the Camera + Serial Port Drivers | CJO | Programming | 22 | 11-01-2006 17:42 |
| Programming Vex Starter Kit To Recieve From Serial Port | firetrap | FIRST Tech Challenge | 0 | 26-09-2005 17:27 |
| TTL port to a serial port on a demo board | ImmortalAres | Programming | 16 | 09-07-2005 23:44 |