Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup() {
- Serial.begin(9600); // Initialize UART communication at 9600 baud
- Serial.setTimeout(1000); // Set a timeout for Serial.read()
- }
- void loop() {
- if (Serial.available() > 0) { // Check if data is available to read
- String message = Serial.readString(); // Read the incoming message
- Serial.print("Received: ");
- Serial.println(message); // Print the received message to the Serial Monitor
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement