Return to SDK Examples for Microchip Studio
#include "ClearCore.h"
#define interruptConnector ConnectorDI6
#define baudRate 9600
#define SerialPort ConnectorUsb
void MyCallback();
int main() {
interruptConnector.Mode(Connector::INPUT_DIGITAL);
interruptConnector.InterruptHandlerSet(MyCallback, InputManager::FALLING,
false);
SerialPort.Mode(Connector::USB_CDC);
SerialPort.Speed(baudRate);
uint32_t timeout = 5000;
SerialPort.PortOpen();
while (!SerialPort &&
Milliseconds() - startTime < timeout) {
continue;
}
while (true) {
interruptConnector.InterruptEnable(true);
SerialPort.SendLine("Interrupts are turned on.");
interruptConnector.InterruptEnable(false);
SerialPort.SendLine("Interrupts are turned off.");
}
}
void MyCallback() {
}