Communicating through TX/RX pins

Learn how to use HardwareSerial to communicate across TX/RX pins and view it on the computer using a USB TTL Serial Cable

Info on using HardwareSerial

Required Components

Create the project

  1. Create a new project from the template.
  2. Plug the USB end of the cable into your computer’s USB port.
  3. Open up Device Manager on your development machine and find out which COM port is being used by the adapter.
  4. Open a terminal program like Tera Term
  5. Set the program to monitor the serial connection from the COM port you found in Step 5.
  6. Make sure your options are as shown below (with the Port set to the COM port you found in Step 5):

    • If you are using Tera Term, you can get to the menu shown above by clicking on Setup -> Serial port..
  7. Hook up the Orange pin from the cable to RX (pin 0)on your Galileo
  8. Hook up the Yellow pin from the cable to TX (pin 1) on your Galileo
  9. Replace the existing code in main.cpp of the project with the code below:

Code

Main.cpp of the Write Project

#include "stdafx.h"
#include "arduino.h"

int _tmain(int argc, _TCHAR* argv[])
{
	return RunArduinoSketch();
}

void setup()
{
    Serial.begin(CBR_300, Serial.SERIAL_7O2);
}

int count = 0;

void loop()
{
    if (Serial.write('a' + count) != 1)
    {
        Log(L"Serial.write failed\n");
    }else{
        Log(L"%c being sent\n", 'a' + count++);
    }
    if (count == 26) { count = 0; }
    Sleep(1000);
}

« Return to Samples