Last active
June 6, 2024 19:30
-
-
Save rdlauer/bca35bad6624f6981ad52cddb3c07cf9 to your computer and use it in GitHub Desktop.
Configuring an Arduino sketch to output Serial data over STLINK interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// configuring an Arduino sketch to output Serial data over STLINK interface | |
#define serialDebug Serial | |
HardwareSerial stlinkSerial(PIN_VCP_RX, PIN_VCP_TX); | |
void setup() | |
{ | |
#ifdef serialDebug | |
stlinkSerial.begin(115200); | |
const size_t usb_timeout_ms = 3000; | |
for (const size_t start_ms = millis(); !stlinkSerial && (millis() - start_ms) < usb_timeout_ms;) | |
; | |
#endif | |
stlinkSerial.println("Hello World (Setup)"); | |
} | |
void loop() | |
{ | |
delay(2000); | |
stlinkSerial.println("Hello World (Loop)"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment