One – Hardware Serials

Hardware Serials

The SODAQ ONE has 3 hardware serials:
SerialUSB – This is for when you are debugging over the USB Cable.
Serial – Serial is attached to pin D12/A12/TX and D13/A12/RX.
Serial1 – Is connected to the RN2483 LoRaWAN Module.

void setup() {
  // put your setup code here, to run once:
  SerialUSB.begin(57600);
  Serial.begin(57600);
  Serial1.begin(57600);
}

void loop() {
  // put your main code here, to run repeatedly:

}


SerialUSB

The sketch starts direct after uploading new code or when connected to a power source.
After opening a Serial Monitor the code will not reset, add the following code to your sketch if you want your sketch to wait for a Serial Monitor.

  while ((!SerialUSB) && (millis() < 30000)) {
    // Wait for SerialUSB or start after 30 seconds
  }