/********* Pleasedontcode.com **********
Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- Terms and Conditions:
You have a non-exclusive, revocable, worldwide, royalty-free license
for personal and commercial use. Attribution is optional; modifications
are allowed, but you're responsible for code maintenance. We're not
liable for any loss or damage. For full terms,
please visit pleasedontcode.com/termsandconditions.
- Project: Scanner
- Source Code compiled for: Arduino Mega
- Source Code created on: 2023-11-02 17:51:41
- Source Code generated by: AlexWind
********* Pleasedontcode.com **********/
/****** DEFINITION OF LIBRARIES *****/
#include
#include
/****** SYSTEM REQUIREMENT 1 *****/
/* Connect two serial ports together and duplicate on HW serial */
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF Software Serial *****/
const uint8_t SERIAL_PIN_RX = 6; // Connect to RX pin of the other serial port
const uint8_t SERIAL_PIN_TX = 7; // Connect to TX pin of the other serial port
SoftwareSerial serialPort(SERIAL_PIN_RX, SERIAL_PIN_TX);
void setup(void)
{
// put your setup code here, to run once:
Serial.begin(9600); // Initialize the serial monitor
serialPort.begin(9600); // Initialize the software serial port
}
void loop(void)
{
// put your main code here, to run repeatedly:
if (serialPort.available())
{
char data = serialPort.read(); // Read data from the software serial port
Serial.print("Received data: ");
Serial.println(data); // Print the received data to the serial monitor
}
}