Return to SDK Examples for Microchip Studio
#include "ClearCore.h"
#define SerialPort ConnectorUsb
#define CcioPort ConnectorCOM0
#define baudRate 9600
int main() {
SerialPort.Mode(Connector::USB_CDC);
SerialPort.Speed(baudRate);
uint32_t timeout = 5000;
SerialPort.PortOpen();
while (!SerialPort &&
Milliseconds() - startTime < timeout) {
continue;
}
CcioPort.Mode(Connector::CCIO);
CcioPort.PortOpen();
while (true) {
SerialPort.Send("CCIOA0 Input state: ");
if (state) {
SerialPort.SendLine("ON");
}
else {
SerialPort.SendLine("OFF");
}
}
}