Skip to content

Commit c457b30

Browse files
authored
Update README.md
1 parent 766f990 commit c457b30

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ In Arduino IDE, go to **Tools > USB** and select **"Adafruit TinyUSB"**
111111

112112
Here's a simple USB MIDI example:
113113
```cpp
114+
#define Serial SerialTinyUSB //Alias to allow Serial Communication throguh TinyUSB
114115
#include <Adafruit_TinyUSB.h>
115116
#include <MIDI.h>
116117

@@ -139,7 +140,27 @@ void loop() {
139140
}
140141
}
141142
```
143+
## Using Serial Monitor with TinyUSB
142144
145+
TinyUSB creates a USB CDC serial port called `SerialTinyUSB`. To use the Arduino Serial Monitor:
146+
147+
**Option 1: Use SerialTinyUSB directly**
148+
```cpp
149+
SerialTinyUSB.begin(115200);
150+
SerialTinyUSB.println("Hello!");
151+
```
152+
153+
**Option 2: Alias Serial (recommended for code portability)**
154+
```cpp
155+
#define Serial SerialTinyUSB
156+
157+
void setup() {
158+
Serial.begin(115200);
159+
Serial.println("Hello!");
160+
}
161+
```
162+
163+
Add the `#define` at the top of your sketch before any other includes.
143164
## Technical Details
144165

145166
### Key Implementation Notes

0 commit comments

Comments
 (0)