Arduino notes-Arduino UNO and WeMos D1 serial communication (data interaction)

tags: C/C++  Arduino

The schematic is like this:

Device A represents Arduino UNO and device B represents WeMos D1.

The actual connection diagram is as follows:

The screenshot of the program is as follows:

This is the serial port print on Arduino. The S in front means Arduino sends character S. When character B is received, it will print receive wemods data

Here is the source code:

Arduino uno source code:

void setup() {

  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);
}


void loop() {
  digitalWrite(LED_BUILTIN, HIGH); 
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW); 
  delay(1000);

  Serial.write("S");
  while(Serial.available() > 0){

     char wemosChar = Serial.read();
     if(wemosChar == 'B'){

       Serial.println("receive wemods data");
     }
  }

  delay(1000);
}

WeMos D1 source code:

void setup() {

  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);
}


void loop() {
  
  digitalWrite(LED_BUILTIN, LOW);                               
  delay(1000);                     
  digitalWrite(LED_BUILTIN, HIGH);  
  delay(1000);     

  while(Serial.available() > 0){

     char getChar = Serial.read();
     if(getChar == 'S'){

        Serial.write("B");
     }
  }

  delay(1000); 
}

 

 

 

Intelligent Recommendation

Arduino Uno and ESP8266 Node MCU communicate serial communication. The sensor data collected by UNO is sent to the MCU

Because there is only one analog interface of the nodemcu, there is no pin to connect when using multiple sensors. This problem has troubled me for a few days. I used to see that others said that I ca...

Notes on communication between Arduino UNO and ESP8266

Notes on communication between Arduino UNO and ESP8266 First let's look at theESP8266EX technical specification》 ESP8266 Electrical Characteristics Diagram We can see that the typical operating voltag...

Arduino Uno + Arduino D1 Realization Alibaba Network Control + IIC Bus Communication Light

Arduino Uno + Arduino D1 Realization Alibaba Network Control + IIC Bus Communication Light Wiring diagram Code Host code (Arduino D1): From Machine Code 1 (Arduino Uno): The slave code 2 (UNO only mod...

arduino wemos D1 SPI communicates with HT7038

The code can be executed first  ...

Install Wemos-D1 R2 driver in arduino IDE

1. Set the baud rate The steps are shown in the figure below, if the device is not recognized, please update the driver 2. Add Wemos-D1R2 library Select File-"Preferences-"Accessory Developm...

More Recommendation

Arduino UNO Data Manual for Arduino

Overview Arduino UNO is an Arduino development board based on ATmega328P. It has 14 digital input/output pins (6 of which can be used for PWM output), 6 analog input pins, a 16 MHz crystal oscillator,...

Wemos D1 serial communication sends 16 credit data

Wemos D1 serial communication sends 16 credit data Problem: Because the speech play module may require a board to send a string of 16-based data to activate the voice playback module or other modules ...

Using Python to implement serial communication - as an example of Arduino Uno

This blog is organized by self-learning, if it is helpful to readers, it is honored. Using Python to implement serial communication - as an example of Arduino Uno Realization principle Basic content P...

Arduino UNO and ESP8266 serial connection

Arduino UNO and ESP8266 serial connection 1. ESP8266 burn AT firmware 1.1 Download the burning software 1.2 Burn AT firmware 2. ESP8266 AT command 3. Arduino UNO serial port connection 4. Arduino UNO ...

Wemos D1 arduino IoT development board application note 7-TCP Client communication in STA mode

Preface This article studies how WeMos D1 performs TCP Client communication in STA mode. The module directly connects to AP (mobile hotspot or router), enters the LAN to communicate with other wireles...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top