Three possibilities to complete this week
Wired
Good explanation of this can be found in Jari Uusitalo's page from 2018.
For duplex communication, use software serial as the hardware UART that is available e.g. in Arduino Uno will not allow swapping modes of the pins assigned for serial communications.
The idea is to have one master (e.g. PC) and multiple slaves connected with two wire bus. See Neil's academy lecture. By default, all the slaves listen on both ports. Once data addressed to one of the slaves is received, that slave switches its other input port (connected to master Rx) to output mode and sends a response which is received by the master as well as all the other slaves. Once the transmission is over the pin is switched back to input (listening) mode.
If only simplex communication between master and slaves is required, there is no need for pin state switching. Example of this can be found e.g. in Yasir's page
Bluetooth
Connecting HM11 (HM10, HM9) to Arduino Uno and making led blink demo. Level shifting should be used in Bluetooth module Rx pin (5v => 3.3v) when Arduino board is used. Voltage divider is fine with moderate baud rates. You can run your own board with 3.3v in which case you do not need any extra components.
BLEScanner is a phone app that can be used to send data to Arduino Uno. The app can be found for Andrdoid and iOS devices.
Develop your own app using MIT App Inventor. Good BLE example.
ESP8266/ESP32
Level shifting should be used when operating with Arduino Uno board. You may have to power ESP with external power source
Tutorial for connecting ESP8266 with Arduino UNO and controlling with Blynk.
Another tutorial from Fab Academy 2018
Control Arduino led from a web page
Control ESP8266 with AT commands
Setting up Arduino IDE for ESP8266 or ESP32 if you want to use the GPIO pins of the ESPs.
Newer firmware uses 115.2kbps and older ones 9.6kbps
EXAMPLE to be used with wired or wireless BLE connection
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2,3);
int ledpin=13;
void setup()
{
mySerial.begin(9600);
Serial.begin(9600);
pinMode(ledpin,OUTPUT);
}
void loop()
{
int i;
if (mySerial.available())
{
i=mySerial.read();
Serial.println("DATA RECEIVED:");
if(i=='2')
{
digitalWrite(ledpin,1);
Serial.println("led on");
}
if(i=='3')
{
digitalWrite(ledpin,0);
Serial.println("led off");
}
}
}
UnoSoftwareSerial.ino SoftwareSerial.ino XiaoHost.inoXiaoRP2040Node.ino