Skip to content

Instantly share code, notes, and snippets.

Created December 10, 2013 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7890458 to your computer and use it in GitHub Desktop.
Save anonymous/7890458 to your computer and use it in GitHub Desktop.
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include "tserial.h"
#include "bot_control.h"
serial comm; //serial is a class type defined in these files, used for referring to the communication device
void main() {
char data; //To store the character to send
printf("Enter character to be sent"); //User prompt
scanf("%c",&data); //User input
comm.startDevice("COM2", 9600);
/* “COM 2” refers to the com port in which the USB to SERIAL port is attached. It is shown by right clicking on my computer, then going to properties and then device manager
9600 is the baud-rate in bits per second */
comm.send_data(data); //The data is sent through the port
comm.stopDevice(); //The device is closed down
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment