Advertisement
pleasedontcode

Arduino 2 - Receiver

Jul 28th, 2024
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Arduino 0.42 KB | Source Code | 0 0
  1. void setup() {
  2.   Serial.begin(9600); // Initialize UART communication at 9600 baud
  3.   Serial.setTimeout(1000); // Set a timeout for Serial.read()
  4. }
  5.  
  6. void loop() {
  7.   if (Serial.available() > 0) { // Check if data is available to read
  8.     String message = Serial.readString(); // Read the incoming message
  9.     Serial.print("Received: ");
  10.     Serial.println(message); // Print the received message to the Serial Monitor
  11.   }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement