#include "SoftwareSerial.h" // Declare and initialize UART pins const int rx_pin = 4; const int tx_pin = 5; // Declare and initialize led pin const int led_pin = 9; // Create new serial with specified UART pins SoftwareSerial mySerial(rx_pin , tx_pin); void setup(){ // Set the pin modes of UART pins pinMode(rx_pin, INPUT); // Receiving requires input pinMode(tx_pin, OUTPUT); // Transmitting requires output // Set led as output pinMode(led_pin, OUTPUT); // Start the serial communication at 9600 bits/sec mySerial.begin(9600); } void loop(){ mySerial.println("100"); // Send the message "100" // Flash the LED digitalWrite(led_pin,HIGH); delay(100); digitalWrite(led_pin,LOW); // Wait some time (500ms in total) delay(400); }