Learn how to use HardwareSerial to read and write to the UART port.
serialEvent1()
that returns void and has no parameters in your main.cpp. This method will be called when data is available on the serial1 port at the end of the loop.#include "stdafx.h"
#include "arduino.h"
int _tmain(int argc, _TCHAR* argv[])
{
return RunArduinoSketch();
}
void setup()
{
Serial1.begin(CBR_9600, Serial.SERIAL_8N1);
}
char output = 'a'; // The character being written
void loop()
{
// Handles the writing
if (Serial1.write((uint8_t)output) != 1)
{
Log(L"Serial1.write failed\n");
}
else
{
Log(L"%c being sent\n", output);
}
// Loops the character from a to z
if (output == 'z')
{
output = 'a';
}
else
{
output++;
}
Sleep(1000);
}