https://docs.arduino.cc/built-in-examples/basics/DigitalReadSerial/
https://www.youtube.com/watch?v=g0pSfyXOXj8 
https://docs.arduino.cc/built-in-examples/basics/DigitalReadSerial/
https://www.youtube.com/watch?v=g0pSfyXOXj8 
arduino pin 8 as serial input
AI Overview
Learn more
Serial and SoftwareSerial • Wolles Elektronikkiste
The line of code SoftwareSerial mySerial(8, 9); is used in Arduino programming to create a software serial object. It initializes a new serial communication port, but instead of using the standard hardware serial port (0 and 1), it utilizes digital pins 8 and 9 for serial communication. This allows you to use other digital pins for other purposes while still having a serial interface. 
Here's a breakdown: 
    SoftwareSerial:
    This is a library that enables serial communication on other digital pins of an Arduino board.
    mySerial:
    This is the name you've given to your software serial object. You can use this name to refer to this specific port when sending and receiving data.
    (8, 9):
    These are the two digital pins that will be used for the software serial port. Pin 8 is typically used for the receive (RX) signal, and pin 9 is used for the transmit (TX) signal. 
How it works:
    1. Include the library:
    Before using SoftwareSerial, you need to include the SoftwareSerial.h library in your code: #include <SoftwareSerial.h>. 
2. Initialize:
The SoftwareSerial mySerial(8, 9); line creates the object and initializes the specified pins for software serial communication. 
3. Use the object:
You'll use the mySerial object (e.g., mySerial.begin(9600); to set the baud rate, mySerial.write(...) to send data, and mySerial.available() and mySerial.read() to receive data). 
4. Connect:
When using software serial, you'll need to connect the RX pin of the other device (e.g., a Bluetooth module, another Arduino) to pin 8 and the TX pin to pin 9. 
5. Baud Rate:
Make sure the baud rate (e.g., 9600, 115200) on both devices is the same for successful communication. 
 
https://www.jeremyblum.com/2011/02/07/arduino-tutorial-6-serial-communication-and-processing/
https://forum.arduino.cc/t/how-can-i-control-an-led-via-the-serial-monitor/1052017
https://toptechboy.com/arduino-lesson-4-printing-over-the-serial-port/ 
https://dronebotworkshop.com/i2c-arduino-arduino/
https://www.circuitbasics.com/how-to-set-up-i2c-communication-for-arduino/
 
MASTER
/*SLAVE
/*
  I2C Slave Demo
  i2c-slave-demo.ino
  Demonstrate use of I2C bus
  Slave receives character from Master and responds
  DroneBot Workshop 2019
  https://dronebotworkshop.com
*/
// Include Arduino Wire library for I2C
#include <Wire.h>
// Define Slave I2C Address
#define SLAVE_ADDR 9
// Define Slave answer size
#define ANSWERSIZE 5
// Define string with response to Master
String answer = "Hello";
void setup() {
  // Initialize I2C communications as Slave
  Wire.begin(SLAVE_ADDR);
  
  // Function to run when data requested from master
  Wire.onRequest(requestEvent); 
  
  // Function to run when data received from master
  Wire.onReceive(receiveEvent);
  
  // Setup Serial Monitor 
  Serial.begin(9600);
  Serial.println("I2C Slave Demonstration");
}
void receiveEvent() {
  // Read while data received
  while (0 < Wire.available()) {
    byte x = Wire.read();
  }
  
  // Print to Serial Monitor
  Serial.println("Receive event");
}
void requestEvent() {
  // Setup byte variable in the correct size
  byte response[ANSWERSIZE];
  
  // Format answer as array
  for (byte i=0;i<ANSWERSIZE;i++) {
    response[i] = (byte)answer.charAt(i);
  }
  
  // Send response back to Master
  Wire.write(response,sizeof(response));
  
  // Print to Serial Monitor
  Serial.println("Request event");
}
void loop() {
  // Time delay in loop
  delay(50);
}