Brief
In this project, you can control the Arduino UNO development board by using the HMI serial port screen and carry out data command interaction through serial port communication. The Arduino Uno development board can upload a series of waveform data and display it on the serial port screen. This project is very helpful for making the ventilator display screen.
The ventilator project I do here will have a startup animation effect after power on, then enter a startup initial solution interface, and display the word "open". Click it to have a voice effect, prompt to open the ventilator, and jump to the page selection interface, where there will be an animation effect, which is an animation to show the human breath, and there are two options The first is the oscillogram monitoring chart of respiration. The second is the oxygen and respiratory rate monitoring chart. How to display so many oscillograms at the same time is a problem. After clicking enter, STONE HMI will issue a specific command to control MCU to start to upload the waveform data.
The functions are as follows:
① realize button setting;
② Realize voice function;
③ realize page switching;
④ realize real-time waveform transmission.
Modules required for the project:
① STONE TFT LCD;
② Arduino Uno module;
connection
GUI design
code sharing
/*
Serial
*/
//#include
#include "stdlib.h"
int incomedate = 0;
//#define UBRR2H
//HardwareSerial Serial2(2);
uint8_t i = 0, count = 0;
uint8_t StartBreathWaveFlag = 0;
uint8_t StartHeartO2WaveFlag = 0;
uint8_t EnterBreathWave[9] = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x12, 0x01, 0x00, 0x01};//
uint8_t BreathBackToBg[9] = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x14, 0x01, 0x00, 0x02};//
uint8_t EnterHeartO2Wave[9] = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x13, 0x01, 0x00, 0x03};//
uint8_t HeartO2BackToBg[9] = {0xA5, 0x5A, 0x06, 0x83, 0x00, 0x15, 0x01, 0x00, 0x04};//
uint8_t RecievedTemp[9] = {0};
uint8_t StartBreathWave[7] = {0xA5, 0x5A, 0x04, 0x84, 0x01, 0x01, 0xFF};//
uint8_t CleanBreathWave[6] = {0xA5, 0x5A, 0x03, 0x80, 0xEB, 0x56};//
uint8_t StartHeartO2Wave[9] = {0xA5, 0x5A, 0x06, 0x84, 0x06, 0x00, 0xFF, 0x00, 0x22};//
uint8_t CleanHeartO2Wave[6] = {0xA5, 0x5A, 0x03, 0x80, 0xEB, 0x55};//
void setup() {
Serial.begin(115200); //115200
}
void loop() {
if (Serial.available() == 9)//
{
for(count = 0; count < 9; count ++)
{
RecievedTemp[count] = Serial.read();
}
if(RecievedTemp[8] == 0x01)
{
StartBreathWaveFlag = 1;
StartHeartO2WaveFlag = 0;
Serial.write(CleanBreathWave, 6);
delay(1000);
}
else if(RecievedTemp[8] == 0x02)
{
StartBreathWaveFlag = 0;
Serial.write(CleanBreathWave, 6);
}
else if(RecievedTemp[8] == 0x03)
{
StartHeartO2WaveFlag = 1;
StartBreathWaveFlag = 0;
Serial.write(CleanHeartO2Wave, 6);
delay(1000);
}
else if(RecievedTemp[8] == 0x04)
{
StartHeartO2WaveFlag = 0;
Serial.write(CleanHeartO2Wave, 6);
}
}
if(StartBreathWaveFlag == 1)
{
delay(1);
Serial.write(StartBreathWave, 7);
i = rand();
StartBreathWave[6] = i;
}
else if(StartHeartO2WaveFlag == 1)
{
delay(1);
Serial.write(StartHeartO2Wave, 9);
i = rand();
StartHeartO2Wave[6] = i;
i = rand();
StartHeartO2Wave[8] = i;
}
}


