Reformat ArduinoBlinkLED example

This commit is contained in:
Kristian Sloth Lauszus 2013-10-30 15:21:50 +01:00
parent 39e28822ba
commit 3c3b8ec986

View file

@ -10,10 +10,9 @@ ADK adk(&Usb,"TKJElectronics", // Manufacturer Name
"http://www.tkjelectronics.dk/uploads/ArduinoBlinkLED.apk", // URL (web page to visit if no installed apps support the accessory)
"123456789"); // Serial Number (optional)
#define LED 13 // Pin 13 is occupied by the SCK pin on a normal Arduino (Uno, Duemilanove etc.), so use a different pin
#define LED LED_BUILTIN // Pin 13 is occupied by the SCK pin on a normal Arduino (Uno, Duemilanove etc.), so use a different pin
void setup()
{
void setup() {
Serial.begin(115200);
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
if (Usb.Init() == -1) {
@ -24,8 +23,7 @@ void setup()
Serial.print("\r\nArduino Blink LED Started");
}
void loop()
{
void loop() {
Usb.Task();
if (adk.isReady()) {
uint8_t msg[1];
@ -33,7 +31,7 @@ void loop()
uint8_t rcode = adk.RcvData(&len, msg);
if (rcode && rcode != hrNAK)
USBTRACE2("Data rcv. :", rcode);
if(len > 0) {
else if (len > 0) {
Serial.print(F("\r\nData Packet: "));
Serial.print(msg[0]);
digitalWrite(LED, msg[0] ? HIGH : LOW);