Geek C - Project tutorial

Appendix at the end of mind map article
Personal website

introduction

Tutorial description

Because there are too many modules, all of them are jumbled together, so each part has a separate file. In order to better describe it, you can switch the canvas or click the link to jump to view it
We should strengthen the core knowledge and learn to integrate it into other projects. For example, you can use single chip microcomputer and display screen to generate and display two-dimensional code, connect student management system to database operation, Gobang to realize man-machine war, and so on. Simple logic implementation is relatively simple, but diversified integration requires a deeper understanding.
With simplicity into complexity, with the sword to break the point, each knowledge point should hit the core and grasp the key points. Everyone's energy is limited. I hope to do more efficient things in a shorter time.

Training program

The project mainly focuses on practice, can write articles, do videos for teaching, analyze every detail of internal knowledge, and master the knowledge of a system through a project. But I can't do the video for the time being because I don't have time

Tutorial summary

Due to the limited time and personal level, the content description of the tutorial is shallow, because the knowledge is wide, it takes a lot of time to go deep into each part, and it takes time to really master it. However, after getting started, you can learn in depth according to your own needs. There are many good open source materials on the Internet, and there will be almost anything you want to learn, so finding resources is also a very important skill.
The project lies in refinement, not more, from simple realization to continuous expansion and refinement, so as to realize more practical and perfect projects. A wide range of knowledge is conducive to the diffusion of thinking, but only by specializing in a certain direction can we have a foothold in the field.
Not a single step, not even a thousand miles

Language text

Fundamentals of C language

Simple program

	Attention
	Header file
	Main function
	notes
	Input and output

data type

	integer
	float 
	Character type
	array
	structural morphology
	union
	enumeration
	Pointer

operator

	Basic operator
	Operator priority
	Self addition and self subtraction operator

Process structure

	while
	do while
	for
	if else
	switch
	goto

function

	Function form
	Function address type
	Recursive function
	Parameter uncertainty
	[ ] Three functions of

memory management

	Type conversion
	Large and small end storage

Bit operation

	Binary conversion
	Bitwise Operators 
	Bit field

File operation

	Open file
	Operation file
	Close file

other

	Type rename
	macro
	Multiple files
	storage class specifier 
	Type qualifier
	Memory partition
	Command line parameters
	random number

Advanced C language

Take notes in ten days

	Basic review
	memory management 
	Pointer
	data structure
	algorithm

Advanced pointer
summary

C + + Basics

C + + introduction
Basic knowledge points

	> 	And C Similar, mainly explain the differences
	> 	2.2 data type	
	> 	2.3 operator	
	> 	2.4 Process structure	
	> 	2.5 function	
	> 	2.6 File operation	
	> 	2.7 memory management 	
	> 	2.8 other

class

3.1 theory	
	3.2 learning method	
	3.3 Class instance	
		3.3.1 Class declaration	
		3.3.2 Declaration object	
		3.3.3 Member call	
		3.3.4 Access modifier 	
		3.3.5 Function member	
		3.3.6 Data member	
3.4 inherit	
	3.4.1 Inheritance instance	
	3.4.2 Polymorphism and virtual function	
	3.4.3 Virtual inheritance	
3.5 other	
Operator reload
	4.1 effect	
	4.2 form	
	4.3 heavy load	
	4.4 Overload instance	
		4.4.1 Cognitive operator	
		4.4.2 Binary operator	
		4.4.3 Unary operator	
		4.4.4 Input / output assignment	
		4.4.5 subscript operator 	
		4.4.6 Increment decrement operator	
		4.4.7 Overload type conversion	
	4.5 Operator overload summary	
Template
	5.1 Function template	
	5.2 Class template	
	5.3 Inherited template	
	5.4. The template type is the template of the class	
	5.5 Template summary	

Standard function library

Basic mathematical operation

	Basic arithmetic operation
	Random number generating function
	trigonometric function
	Hyperbolic function
	Logarithm and exponent
	power function

character string

	String to number
	Number to string
	String to floating point number
	Floating point to string

Function library

	Date and time
	nonlocal jump 
	signal
	Variable parameter input / output
	execution environment 
	locale function
	Return value as pointer function

STL

container
	array
		array,vector
	Linked list (one-way linked list, two-way linked list)
		list/forward_list
			list lt; 
	Stack
		stack
	queue
		deque
	tree
		map/set
	hash surface
		hash_map
 algorithm
	algorithm
 Iterator( iterator)
	string
		string::ierator ite;
	vector
		vector<int>::iterator ite;
	list
		list<Node>::iterator ite;
Adapter
 distributor
 functor 
STL summary

MCU chapter

51

Basic experiment

1,C51 Basic knowledge of, regc51.h What is the use of header files?
2,51 What is the basic composition of the minimum system board and how to use it Proteus How to draw?
3,keil The basic use of software, how to burn the program into the single chip microcomputer chip?
4,How to control LED Light on and off, what is the principle and how to write the program?
5,How to write the water lamp program and what are the methods?
6,What is nixie tube? What is the basic composition and lighting principle of unit nixie tube?
7,How to make a single nixie tube display the number you want, and how to write the program?
8,The composition of multi digit nixie tube, the difference between static display and dynamic display, what are off selection and bit selection, and what are their functions?
9,What is dot matrix, the principle of dot matrix, how to control the display of dot matrix, and how to write the program?
10,The function of independent keys, if controlled by keys LED Lamp and nixie tube, how to write the program?
11,What is the basic structure and detection principle of matrix keyboard and how to write the program?
12,The concept of interrupt, the processing mechanism of interrupt, and how to use interrupt in program?
13,timer/What is the principle and programming method of the counter?
14,Serial communication principle, how does MCU communicate with MCU?
15,Single chip microcomputer and PC Serial communication principle and programming method?
16,Serial port to parallel port USB Principle of serial port?
17,A/D Conversion principle?
18,D/A Conversion principle?
19,common A/D and D/A Conversion chip, and how to use it?
20,PWM What is the principle of pulse speed regulation and how to program the output PWM Bo?
21,LED1602 liquid crystal
22,LCD12864 liquid crystal
 Common chip
	Latch
	38 decoder
	4 - 16 decoder
	Drive module
	MAX7219
	wait

STM32

1,brief introduction
2,Basic use
3,GPIO
4,External interrupt
5,timer
6,Serial port
7,PWM
8,ADC,DAC
9,IIC
10,SPI
11,Related peripherals

Peripherals

ADC/DAC
RTC
Timer/Watchdog Timer(Timer)
Flash/NAND Fiash
ROM/EEPROM
RAM
	SDRAM
	DDR1 DDR2 DDR3 DDR4
Cache
PWM
I/O / GPIO
USART
Modem
DTMF
CAN
SPI
I2C
IEEE
CRC
interrupt((interrupt)
Start with basic knowledge, such as GPIO,Serial port, timer, interrupt, PWM,I2C,SPI wait

Sensor

RIP(Human body (infrared)
Temperature(Temperature)
humidity sensor(Temperature sensor)
geomagnetic sensor(Geomagnetic sensor)
acceleration transducer(Acceleration sensor)
optoelectronic switch(Photoelectric switch)
pneumatic sensor(Air flow sensor)
current sensor(Current sensor)
soil sensor(Soil sensor)
liumination sensor(Light sensor)
laser sensor(Laser sensor)
Motion(Sports)
Moisture sensor(Soil moisture sensor)
Voltage sensor
Three-axis gyroscope(Triaxial gyroscope)
Camera Photosensitive element (Graphic sensor)
Air pressure sensor
 Gas sensor
 Dust concentration sensor
 Water level sensor
 Pulse sensor
 Cortical potential sensor
 Bending sensor
 Proximity sensor

I haven't contacted many of them. I list so many, mainly for expansion. If you are interested, you can learn about them

Communication

USART
I2C
RS232C/RS485
SPI/SCI/SI
CAN
USB
FireWire
1-wire
 Network protocol
HTTP
CoAP
MQTT
XMPP
WebSocket
UDP
HTTP

I haven't learned some yet. I've listed so many, mainly for expansion. If you are interested, you can learn about them

Actuator

DC motor
	Brushless DC motor
	Brushless DC motor
 alternating current dynamo
	Single phase motor
	Three phase motor
 Stepper motor
 Linear motor
 steering engine

It's OK to use, but it's difficult to understand a lot of control principles to go deep into the principle

Fundamentals of circuit

Main related courses

	Fundamentals of circuit analysis
	Analog circuit
	digital circuit 
	website

Electronic Component

	Power Supply
	capacitance
	Protector
	switch
	resistance
		Thermistor
		Varistor
		Photosensitive resistance
	Electromagnetic induction device
	Resistance row
	Piezoelectric device, crystal resonator
	diode
	triode
	transistor

Flight chapter

Four rotor

Basic composition and principle of four rotor
 IV. rotor assembly and commissioning
 Simulator installation and flight
 Actual combat flight
 Core knowledge
	Hardware assembly
		frame
		Flight control
		Electric regulation
		electric machinery
		Optical flow
		gyroscope
		Electronic compass
		laser ranging 
		wait
	Main control chip
		STM32F407
		Anything else will do
	Flight control correlation algorithm
		PID
		filtering algorithm 
		Attitude solution
		Data fusion

Fixed wing

Basic composition and principle of fixed wing
 Fixed wing assembly and commissioning
 Simulator installation and flight
 Actual combat flight

Software project

snake

realization
	pure C realization
	C++realization
	+Image library
 main program
 Snake module
 Wall module
 Food module
 Snake Movement
 expand

Gobang

Main function
	void judge(int y,int x,int color)
		Judge the number of pieces connected in 4 directions at the current position. The parameter is piece color 1 white and 2 black
	bool pieceSet(int y, int x,int color
		Place chess pieces and return true Indicates successful placement, false Indicates that the placement failed
	void initGame()
		void initGame()
	void initView()
		Initialization interface
	void drawPiece(int x,int y,int color)
		Draw chess pieces
	void AI()
		Machine judgment program
	void playerVSplayer()
		Everyone fights
	void playerVSAI()
		Man machine combat

Tetris

   Setting interface display information
    Block operation
	    Generate block
	    Draw a square
	    Draw the next box
	    Block motion
	    Operational limitations
	    Score cancellation
	    Death judgment
    Left and right column information update

Student management system

Register login
    1,Set cursor position
    2,Output main menu
    3,Login operation
    4,Registration operation
    5,Visitor login
    6,Exit the system
    7,User access
    8,Menu command
 Operation management
    1,main interface
    2,Add operation
    3,Read write file
    4,see
    5,delete
    6,modify
    7,sort
    8,examination
    9,sign out
    10,Overall planning logic

File encryption and data analysis

 Data analysis and solution
 MD5 algorithm

QR code generation

Basic knowledge
	Positioning pattern
	Functional data
	Data code and error correction code
 Data coding
	Example 1: digital coding
	Example 2: character encoding
 Terminator and complement
	Press 8 bits rearrangement
	Complement code( Padding Bytes)
Error correcting code
 Final coding
	Interspersed placement
	Remainder Bits
 Draw QR code diagram
	Position Detection Pattern
	Alignment Pattern
	Timing Pattern
	Format Information
	Version Information
	Data and data error correction code
	Mask pattern

Professional articles

I haven't studied these projects yet. I think it's good to see them on the Internet. I'll go and have a look when I have time. There are GitHub If you want to learn, you can go and have a look.
https://github.com/TheAlgorithms/C
	
https://github.com/ithewei/libhv
	
https://github.com/Light-City/CPlusPlusThings
	
https://github.com/JakubVojvoda/design-patterns-cpp
	
https://github.com/tmux/tmux
	
https://github.com/netdata/netdata

Internet of things project

QT host computer

brief introduction

What is? QT?
		Qt Is a cross platform C++ Frame( C++Library), which can be used to write graphic interface applications. Here we mainly use it to write computer software and communicate with the lower computer
QT Installation and use
	Build a new project
	Text box
	Edit box
	Button
	picture
	Page layout
	How do I change the background of a control
		Introducing picture resources
		Change control background
	ui Controls and cpp Program association
	Prompt information
	Page conversion
	Change software page icon
	Generate dynamic link library
	function
		TCP signal communication
			client
			The server
		UDP signal communication
			client
			The server
		Serial port
		Bluetooth communication
			host
			Slave
QT Modules and classes
	QT Basic module
		15 individual QT Basic module
			QT core
				Core functions
					The Meta-object System Source object system
					Tread thread 
					I/O
					container
					Resource system
					The Animation Framework Animation frame
					The Property System Attribute system
					object model 
					Signal and slot
					The Event System Event system
					The state Machine Framework State machine framework
					JSON support  Json support 
					QT Plugins establish Qt plug-in unit
				QT core class
					IO class
					Container Classes Container class
					Threading Classes Thread class
					Implicitly Shared Classes Implicitly shared class
					Animation Classes Animation class
					Event Classes Event class
					State Machine Classes State machine class
					Plugin Classes Plug in class
			QT GUI
				Core functions
					Application Windows Program window
					2D Graphics 2D graphical
					OpenGL and OpenGL ES Integration   OpenGL and OpenGL ES Integration of
				QT GUI class
					Event Classes Event class
					Painting CLasses Painting class
					Rendering in 3D 3D Render class
			QT widgets
				Styles style
				Layouts layout
				Model/VIew Classes Model/View class
				Graphics View Plan view
			Qt QML
			QT Quick
			QT Quick Controls
			QT Quick Dialogs
			QT Quick Layouts
			QT Multimedia
				C++class
					QAudio OutPut
					QCamera
					QCameramageCapture
					QMediaPlayer
					QRadioTuner
					QVideoRendererControl
				QML class
					Audio
					Camera
					MediaPlayer
					Radio
					video
			QT Multimedia Widgets
			QT WebKit
			QT WebKit Widgets
			QT NetWork
			QT Sql
			QT Test
		QT WebView
	QT Add on module
		QT Open source free add ons
			Cross platform module
				Enfinio
				Qt Canvas 3D
				QT Concurrent 
				QT D-Bus
				QT Graphical Effects
				QT Image Formats
				QT Platform Headers
				QT Positioning
				QT Location
				QT Quick Extras
				QT Quick WIdgets
				QT Script and QT Script Tools
				QT SVG
				QT WebChannel
				QT WebSockets
			Platform specific modules
				Active QT     Windows
				QT Bluetooth    Android/iOS/Linux/ OS X
				QT NFC 	Linux
				QT Sensors  Android/iOS/WInRT
				QT Serial Port Windows/Linux/OS X
				QT WebEngine And QT WebEngine Widgets  WIndows/Linux/OS X
				QT WIndows/Mac/X11/Android Extras Windows,OS X,Linux/X11,Android
			Modules that are no longer recommended
				QT Open GL
				QT Declarative
		QT Enterprise value added module
			QT for Device Creation
			QT Charts
			QT Quick Compiler
			QT Data Visualization
			QT Purchasing
			QT Virtual Keyboard
			QT Quick 2D Renderer
signal communication
	UDP
	TCP
	Serial port
 Actual combat project
	A computer software

ESP8266

AT Instruction mode
	SAT pattern
		As a client, you need to connect to the server for data transmission
	AP pattern
		As a server, open hot spots and have IP Address and port number, other clients can connect
	STA+AP pattern
		Both, but I don't like it very much
 As arduino development
	Use electric light technology to connect to Alibaba cloud and bind Xiaoai students
	MQTT signal communication
	TCP signal communication
	UDP signal communication
TCP signal communication
	Server/Client
	How to connect?
(use AT instructions)
		ESP8266 Common instructions
			Configure server instructions( AP Mode)
				1,Set mode to AP pattern: AT+CWMODE=2
				2,Restart the module: AT+RST
				3,AT+CWSAP="wifi name","wifi password",1,3
				4,View the of the module ip address:command: AT+CIFSR
				5,AT+CIPMUX=1 Set to multi connection mode and start the module
				6,AT+CIPSERVER=1,8090 Setting port of the server
			Configure server instructions( STA Mode)
				1,AT+CWMODE=1  to configure STA pattern
				2,AT+RST  Restart effective
				3,AT+CWJAP="wifi name","WiFi password"    connect WIFI
				4,AT+CIPSTART="TCP","192.168.4.1",8090   Connect server
				5,AT+CIPSEND=4     Send instructions
				6,AT+CIPMODE=1    Turn on transparent transmission mode
				7,AT+CIPSEND    Start transmission
		Single chip microcomputer as server
			realization
				Overall process
					Configure a serial port, and then STM32 Serial port and ESP8266 Serial port connection
					Transfer data from 32 to ESP8266 Upper, for ESP8266 Initialization, or ESP8266 The data is transmitted to 32 to realize message mutual transmission
				ESP8266 initialization
					void esp8266_start_trans(void)
{
	//Set working mode 1: station mode 2: AP mode 3: compatible with AP+station mode
	esp8266_send_cmd("AT+CWMODE=2","OK",50);
	//Wifi module restart
	esp8266_send_cmd("AT+RST","OK",20);
	delay_ms(1000);         //Delay for 3S and wait for successful restart
	delay_ms(1000);
	delay_ms(1000);	
	//AP mode
	//esp8266_send_cmd("AT+CWSAP=\"Geek\",\"12345678\",1,4","OK",200); / / set the account and password of the hotspot
	esp8266_send_cmd("AT+CIPMUX=1","OK",20);  
	esp8266_send_cmd("AT+CIPSERVER=1,8080","OK",200);
}
					It can be seen from the above code  esp8266_send_cmd The function is to ESP8266 Sending instructions is sent through serial port. The specific implementation depends on the engineering code   
			Connected
				Mobile client
				MCU client
				Computer client
		MCU as client
			realization
				Overall process
					Configure a serial port, and then STM32 Serial port and ESP8266 Serial port connection
				ESP8266 initialization
					//ESP8266 module and PC enter transparent transmission mode
void esp8266_start_trans(void)
{
	//Set working mode 1: station mode 2: AP mode 3: compatible with AP+station mode
	esp8266_send_cmd("AT+CWMODE=1","OK",50);
	
	//Command to restart Wifi module
	esp8266_send_cmd("AT+RST","ready",20);
	
	delay_ms(1000);         //Delay for 3S and wait for successful restart
	delay_ms(1000);
	delay_ms(1000);
	delay_ms(1000);
	
	//Let the module connect to its own route
	while(esp8266_send_cmd("AT+CWJAP=\"GeekPan\",\"12345678\"","WIFI GOT IP",600));
	
	//=0: single connection mode = 1: multi connection mode
	esp8266_send_cmd("AT+CIPMUX=0","OK",20);
	
	//Establish a TCP connection. These four items respectively represent the ID number 0 ~ 4 connection type remote server IP address remote server port number to be connected
	while(esp8266_send_cmd("AT+CIPSTART=\"TCP\",\"192.168.4.1\",8090","CONNECT",200));
	
	//Whether to turn on transparent transmission mode 0: it means to turn off 1: it means to turn on transparent transmission
	esp8266_send_cmd("AT+CIPMODE=1","OK",200);
	
	//The instruction to start sending data in transparent mode. After this instruction, you can send data directly
	esp8266_send_cmd("AT+CIPSEND","OK",50);
}
					It can be seen from the above code  esp8266_send_cmd The function is to ESP8266 Sending instructions is sent through serial port. The specific implementation depends on the engineering code   
			De connection
				Single chip microcomputer server
				Mobile server
				Computer server
		summary
			ESP8266 Initialization process
				Configure serial port
					The baud rate of serial port is 9600, because it may not be realized if it is too high in hardware
				Write serial port send instruction function
					Used to give ESP8266 Send corresponding AT Instruction, initialization
				The initialization client is similar to the server, except that the instructions sent are different, but they all need to be sent through the serial port
				The hardware connection is TX meet RX,RX meet TX
			Configuration ideas
				If the MCU is used as a server, then ESP8266 namely AP Mode, open hotspot, ownership IP Address and port number TCP When the client wants to connect to the server, it needs to connect to the hotspot before binding IP Address and port number to connect
				If it is STA Mode, you need to connect to the hotspot of the server and bind IP Address and port number to connect
			Connection range
				Because it's using WIFI Local communication is only effective in the local network. If you want to realize Wan communication, you can connect to the cloud server, which needs to be used WIFI Or flow configuration
	How to transmit data
		send data
 receive data 
			STM32 And ESP8266
				It mainly uses serial port for data transmission
				STM32 Serial port sending data
					code implementation
						//Send command to ESP8266
//cmd: command string sent; ack: the expected response result. If it is empty,
//It means that there is no need to wait for a response; waittime: waiting time (unit: 10ms)
//Return value: 0, the transmission is successful (the expected response result is obtained); 1. Sending failed
u8 esp8266_send_cmd(u8 *cmd,u8 *ack,u16 waittime)
{
	u8 res=0; 
	USART3_RX_STA=0;
	u3_printf("%s\r\n",cmd);	//dispatch orders
	if(ack&&waittime)		//Need to wait for response
	{
		while(--waittime)	//Wait for countdown
		{
			delay_ms(10);
			if(USART3_RX_STA&0X8000)//Expected response result received
			{
				if(esp8266_check_cmd(ack))
				{
					printf("ack:%s\r\n",(u8*)ack);
					break;//Get valid data 
				}
					USART3_RX_STA=0;
			} 
		}
		if(waittime==0)res=1; 
	}
	return res;
}
					USART3_RX_STA
						One unsigned short Variable of
					USART3_RX_BUF
						Receive buffer
				STM32 Serial port receiving data
					code implementation
						if(USART3_RX_STA&0x8000)
{
	printf("USART3_RX_BUF=%s\r\n",USART3_RX_BUF);
	sprintf(a,"%s",USART3_RX_BUF);
	printf("a=%s",a);
	if(strstr((const char*)a,"on"))  GPIO_ResetBits(GPIOB,GPIO_Pin_5);
				
	if(strstr((const char*)a,"off")) GPIO_SetBits(GPIOB,GPIO_Pin_5);
				
	USART3_RX_STA=0;
}
					USART3_RX_STA
						One unsigned short Variable of
					USART3_RX_BUF
						Receive buffer
					Attention
						because ESP8266 The data sent by serial port to 32 has different data formats, so it is necessary to filter out redundant data
					The specific implementation depends on the overall engineering code
			Client And Server
				Client send and receive
					Client It's a single chip microcomputer
						esp8266_send_cmd("data","OK",50);
						Data sending process
							The client uses the serial port to the client ESP8266 send data
							Because the client has connected to the server, and then the data is transmitted to the server ESP8266 upper
							Server ESP8266 The serial port is used to send data to 32
							Finally 32, the data is obtained, and the corresponding actions can be performed according to the data
						Picture diagram
							
					Client It's the upper computer
						The host computer is simply understood as computer software and mobile phone software, which can be used to control MCU
						The data sent by the host computer is directly transmitted to the server ESP8266 And then use the serial port to send it to 32
						Sketch Map
							
				Server send and receive
					Server It's a single chip microcomputer
						Similarly
					Server It's the upper computer
						Similarly

Android project

What is? Android?
	Can develop mobile phones APP
 How to develop an installation APP
	development environment 
		Android Studio
	Create a new basic project and test the development environment
		New blank project
		utilize USB Connect the cable to the computer
		Mobile phone enters developer mode
		Turn on the phone USB Installation and commissioning
		stay Android Studio Running program in
			If the development environment is correct, one will be installed on the mobile phone APP
	control
		Key
		Picture button
		Text box
		Edit box
		Selector switch
		expand
			SeekBar 
			progress bar
			Browser box
			Map
			Radio 
			check box
	function
		TCP signal communication
			client
			The server
		UDP signal communication
			client
			The server
		Serial port
		Bluetooth communication
			host
			Slave
		MQTT signal communication
			Connect external MQTT The server

Smart home project

signal communication
	LAN
	Wide area network
	ESP8266 Basic tutorial
		AT Instruction mode
			SAT pattern
				As a client, you need to connect to the server for data transmission
			AP pattern
				As a server, open hot spots and have IP Address and port number, other clients can connect
			STA+AP pattern
				Both, but I don't like it very much
		As arduino development
			Use electric light technology to connect to Alibaba cloud and bind Xiaoai students
			MQTT signal communication
			TCP signal communication
			UDP signal communication
		TCP signal communication
			Server/Client
			How to connect?
(use AT instructions)
				ESP8266 Common instructions
					Configure server instructions( AP Mode)
						1,Set mode to AP pattern: AT+CWMODE=2
						2,Restart the module: AT+RST
						3,AT+CWSAP="wifi name","wifi password",1,3
						4,View the of the module ip address:command: AT+CIFSR
						5,AT+CIPMUX=1 Set to multi connection mode and start the module
						6,AT+CIPSERVER=1,8090 Setting port of the server
					Configure server instructions( STA Mode)
						1,AT+CWMODE=1  to configure STA pattern
						2,AT+RST  Restart effective
						3,AT+CWJAP="wifi name","WiFi password"    connect WIFI
						4,AT+CIPSTART="TCP","192.168.4.1",8090   Connect server
						5,AT+CIPSEND=4     Send instructions
						6,AT+CIPMODE=1    Turn on transparent transmission mode
						7,AT+CIPSEND    Start transmission
				Single chip microcomputer as server
					realization
						Overall process
							Configure a serial port, and then STM32 Serial port and ESP8266 Serial port connection
							Transfer data from 32 to ESP8266 Upper, for ESP8266 Initialization, or ESP8266 The data is transmitted to 32 to realize message mutual transmission
						ESP8266 initialization
							void esp8266_start_trans(void)
{
	//Set working mode 1: station mode 2: AP mode 3: compatible with AP+station mode
	esp8266_send_cmd("AT+CWMODE=2","OK",50);
	//Wifi module restart
	esp8266_send_cmd("AT+RST","OK",20);
	delay_ms(1000);         //Delay for 3S and wait for successful restart
	delay_ms(1000);
	delay_ms(1000);	
	//AP mode
	//esp8266_send_cmd("AT+CWSAP=\"Geek\",\"12345678\",1,4","OK",200);  // Set the account and password of the hotspot
	esp8266_send_cmd("AT+CIPMUX=1","OK",20);  
	esp8266_send_cmd("AT+CIPSERVER=1,8080","OK",200);
}
							It can be seen from the above code  esp8266_send_cmd The function is to ESP8266 Sending instructions is sent through serial port. The specific implementation depends on the engineering code   
					Connected
						Mobile client
						MCU client
						Computer client
				MCU as client
					realization
						Overall process
							Configure a serial port, and then STM32 Serial port and ESP8266 Serial port connection
						ESP8266 initialization
							//ESP8266 module and PC enter transparent transmission mode
void esp8266_start_trans(void)
{
	//Set working mode 1: station mode 2: AP mode 3: compatible with AP+station mode
	esp8266_send_cmd("AT+CWMODE=1","OK",50);
	
	//Command to restart Wifi module
	esp8266_send_cmd("AT+RST","ready",20);
	
	delay_ms(1000);         //Delay for 3S and wait for successful restart
	delay_ms(1000);
	delay_ms(1000);
	delay_ms(1000);
	
	//Let the module connect to its own route
	while(esp8266_send_cmd("AT+CWJAP=\"GeekPan\",\"12345678\"","WIFI GOT IP",600));
	
	//=0: single connection mode = 1: multi connection mode
	esp8266_send_cmd("AT+CIPMUX=0","OK",20);
	
	//Establish a TCP connection. These four items respectively represent the ID number 0 ~ 4 connection type remote server IP address remote server port number to be connected
	while(esp8266_send_cmd("AT+CIPSTART=\"TCP\",\"192.168.4.1\",8090","CONNECT",200));
	
	//Whether to turn on transparent transmission mode 0: it means to turn off 1: it means to turn on transparent transmission
	esp8266_send_cmd("AT+CIPMODE=1","OK",200);
	
	//The instruction to start sending data in transparent mode. After this instruction, you can send data directly
	esp8266_send_cmd("AT+CIPSEND","OK",50);
}
							It can be seen from the above code  esp8266_send_cmd The function is to ESP8266 Sending instructions is sent through serial port. The specific implementation depends on the engineering code   
					De connection
						Single chip microcomputer server
						Mobile server
						Computer server
				summary
					ESP8266 Initialization process
						Configure serial port
							The baud rate of serial port is 9600, because it may not be realized if it is too high in hardware
						Write serial port send instruction function
							Used to give ESP8266 Send corresponding AT Instruction, initialization
						The initialization client is similar to the server, except that the instructions sent are different, but they all need to be sent through the serial port
						The hardware connection is TX meet RX,RX meet TX
					Configuration ideas
						If the MCU is used as a server, then ESP8266 namely AP Mode, open hotspot, ownership IP Address and port number. other TCP When the client wants to connect to the server, it needs to connect to the hotspot before binding IP Address and port number to connect
						If it is STA Mode, you need to connect to the hotspot of the server and bind IP Address and port number to connect
					Connection range
						Because it's using WIFI Local communication is only effective in the local network. If you want to realize Wan communication, you can connect to the cloud server, which needs to be used WIFI Or flow configuration
			How to transmit data
				send data
 receive data 
					STM32 And ESP8266
						It mainly uses serial port for data transmission
						STM32 Serial port sending data
							code implementation
								//Send command to ESP8266
//cmd: command string sent; ack: the expected response result. If it is empty,
//It means that there is no need to wait for a response; waittime: waiting time (unit: 10ms)
//Return value: 0, the transmission is successful (the expected response result is obtained); 1. Sending failed
u8 esp8266_send_cmd(u8 *cmd,u8 *ack,u16 waittime)
{
	u8 res=0; 
	USART3_RX_STA=0;
	u3_printf("%s\r\n",cmd);	//dispatch orders
	if(ack&&waittime)		//Need to wait for response
	{
		while(--waittime)	//Wait for countdown
		{
			delay_ms(10);
			if(USART3_RX_STA&0X8000)//Expected response result received
			{
				if(esp8266_check_cmd(ack))
				{
					printf("ack:%s\r\n",(u8*)ack);
					break;//Get valid data 
				}
					USART3_RX_STA=0;
			} 
		}
		if(waittime==0)res=1; 
	}
	return res;
}
							USART3_RX_STA
								One unsigned short Variable of
							USART3_RX_BUF
								Receive buffer
						STM32 Serial port receiving data
							code implementation
								if(USART3_RX_STA&0x8000)
{
	printf("USART3_RX_BUF=%s\r\n",USART3_RX_BUF);
	sprintf(a,"%s",USART3_RX_BUF);
	printf("a=%s",a);
	if(strstr((const char*)a,"on"))  GPIO_ResetBits(GPIOB,GPIO_Pin_5);
				
	if(strstr((const char*)a,"off")) GPIO_SetBits(GPIOB,GPIO_Pin_5);
				
	USART3_RX_STA=0;
}
							USART3_RX_STA
								One unsigned short Variable of
							USART3_RX_BUF
								Receive buffer
							Attention
								because ESP8266 The data sent by serial port to 32 has different data formats, so it is necessary to filter out redundant data
							The specific implementation depends on the overall engineering code
					Client And Server
						Client send and receive
							Client It's a single chip microcomputer
								esp8266_send_cmd("data","OK",50);
								Data sending process
									The client uses the serial port to the client ESP8266 send data
									Because the client has connected to the server, and then the data is transmitted to the server ESP8266 upper
									Server ESP8266 The serial port is used to send data to 32
									Finally 32, the data is obtained, and the corresponding actions can be performed according to the data
								Picture diagram
									
							Client It's the upper computer
								The host computer is simply understood as computer software and mobile phone software, which can be used to control MCU
								The data sent by the host computer is directly transmitted to the server ESP8266 And then use the serial port to send it to 32
								Sketch Map
									
						Server send and receive
							Server It's a single chip microcomputer
								Similarly
							Server It's the upper computer
								Similarly
PCB set up
 Reference website
 hardware design 
	ESP8266-NODEMCU Development board
	ESP32-cam
	peripheral
		DHT11 Temperature and humidity sensor
		Photosensitive sensor
		AS608 Optical fingerprint module
		steering engine
		Gear motor
		Stepper motor
		Infrared tube
		OLED display
		LED lamp
		other
 software design 
	Server side
		1.node-red
			node-red Is a very convenient online visual programming, and provides web Component framework, which is convenient for test development; The figure below is node-red Online development environment, visual drag and drop tool is OK.
		2.MQTT The server
			EMQ Mainly used to build MQTT There are many ready-made free servers on the Internet MQTT The server can be used, but its own is the best; When used node-red During the service, the line will drop and the service will hang up. This situation is caused by the lack of hosting node-red Auto exit, you can use dockter Managed installation (but I didn't know at the beginning, so I searched and found it forever This hosting tool is very simple to use and has no problems),The figure below is EMQ Built in management background. There are many functions, but they are useless. They are mainly used for MQTT Server usage

Embedded project

Basic knowledge
	51
	STM32
		keil Installation and use of software
			install
				Software installation and cracking
					keil5 Installation package
					Register machine
				Related driver and support package
					Serial Drivers 
					JlinkSTlink drive
					51
					STM32F10X/F4
					wait
				Install whatever you need
			use
				Build a new project
				Use someone else's project
				keil Some important operations
		Program burning
			Serial port download
			Emulator Download
				Jlink download
				STlink download
				Other downloads
		Light one LED lamp
			to configure IO mouth
				void GPIO_Config(void)                            //GPIO initial configuration
{
    GPIO_InitTypeDef GPIO_InitStructure;      //Define structure variables

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE); //Enable GPIOD clock

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;                    //Specify pin 13
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;        //Set output rate 50MHz
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;        //Push pull output mode
    GPIO_Init(GPIOD, &GPIO_InitStructure);                            //Initialize peripheral GPIOx register
}
			take IO Pull the mouth up or down
				GPIO_ResetBits(GPIOD,GPIO_Pin_13);
					PD13 Pin pull down
				GPIO_SetBits(GPIOD,GPIO_Pin_13);
					PD13 Pin pull up
		LED The lamp flashes
			stay LED Add a delay function based on the light on and off
			integrate into delay.h And delay.c file
		Integrate other module programs in the project
			Independent key
				Make relevant settings
			Temperature and humidity sensor
				Obtain the current ambient temperature and humidity and display it to the upper computer
			0.96 inch OLED
				display
			DC motor, motor drive, fan blade
				Fan
			Buzzer
				alert
			RFID-RC522
				entrance guard card
			ESP8266 modular
				Core module of communication
			Can see, use and change
				As for the specific principle inside each module, if you are not particularly interested, you don't need to understand it, just use it
	sensor
		motor drive 
			L298N
			TB6612FNG
			L9110S
		ranging
			laser ranging 
			Ultrasonic ranging
		OLED
		WIFI
		Bluetooth
		rocker
		Language module
		steering engine
		camera
		Picture transmission
		MPU6050
		wait
 Actual combat project
	Smart car project
		Intelligent car remote control system
		Balance trolley
	Linglong robot (hardware)
		Robot self balancing
			Main modules
				MUP6050
				Motor, motor drive
				Robot body
			Design ideas
				PID algorithm
		OLED Display relevant information
			Display relevant parameters, such as attitude, ranging, literature, image information, etc
		Ultrasonic ranging
			Measure the distance. You can use the distance to design the action
		Steering gear controls body movements
		Voice control robot action
		WIFI signal communication
			utilize APP Control the basic actions of the robot
		Hardware rocker
			Using rocker to control robot action
		Wireless image transmission
			Display image information
		image recognition
			Realize the designed function according to the image
	After mastering the core knowledge, you can do what you want to do. There are not many projects, but you should be able to digest the internal knowledge.

Aided design

Welding and basic measuring tools

Digital multimeter
	Turn to the measuring gear before measurement. Note that the range marked on the gear is the maximum value
 tin suction device
 Electric complex iron
	Master the temperature of the electric soldering iron. When rosin is added to the chrome iron, soft white smoke will appear without"squeak"It is the best welding state when it sounds. Control the welding time, not too long, which will damage the components and circuit board. Remove the dirt of the solder joint, remove the oxide layer of the welded original with a knife, and tin it with rosin and tin in advance.
tin solder
	Welding supplies with rosin in the middle of tin
 rosin
	Welding supplies for removing oxides
 scaling powder
	The function is the same as that of rosin, but the effect is better than that of rosin. However, because the flux contains acid, the used originals should be wiped with sprinkling essence to prevent corrosion.
Oscilloscope
	Oscilloscope is an instrument used to measure the shape of alternating current or pulse current wave. It is composed of electron tube amplifier, scanning oscillator, cathode ray tube, etc. In addition to observing the waveform of current, it can also measure frequency, voltage intensity, etc. All periodic physical processes that can become electrical effects can be observed with an oscilloscope.
	Classification editing
 Vernier caliper
	Vernier caliper( VERNIER CALLIPER),The vernier caliper is composed of a main ruler and a vernier attached to the main ruler that can slide.
other
	Learn what you use

PCB drawing board and printing

Software installation
	AD
		It's a little difficult to get started
	Li Chuang EDA
		Main introduction
	Anything else will do
PCB What is it?
	pcb
 Why PCB?
	Reduce redundant lines
	Because if the project is connected with bread board and DuPont line, it will look disorderly and unsightly as a whole. Moreover, once there are too many modules, it is not easy to check the errors. If it is used PCB,You can use the software to draw the board you want, then print it, and then install the corresponding module.
How to print PCB?
	Jialichuang
		https://www.jlc.com
	Jinbangda
		http://pay.jinbang-pcb.com/Order_add.aspx
	Shun Yijie
		https://www.syjpcb.com
	Huaqiu
		https://www.hqpcb.com
PCB Document making method
	preparation in advance
		This includes the preparation of component library and schematic diagram. "If you want to do well, you must first sharpen its tools". To make a good board, you should not only design the principle, but also draw it well PCB Before designing, first prepare the components(Schematic library and PCB library). Component libraries can be created with EDA The content of component library is rich.
	PCB Structural design
		This step is based on the determined board size PCB Drawing in design environment PCB The board surface, and place the required connectors and keys according to the positioning requirements/Switches, screw holes, assembly holes, etc. and fully consider and determine the wiring area and non wiring area.
	PCB layout
		Reasonable zoning according to electrical performance, generally divided into: digital circuit area(Fear of interference and produce interference),Analog circuit area(Fear of interference),Power drive area(Interference source);
		Circuits that complete the same function shall be placed as close as possible, and all components shall be adjusted to ensure the simplest connection;At the same time, adjust the relative position between functional blocks to make the connection between functional blocks the most concise;
		For components with high quality, the installation position and installation strength shall be considered;Heating elements shall be placed separately from temperature sensitive elements, and thermal convection measures shall be considered if necessary;
		I/O The driver shall be close to the edge of the printed board and the outgoing connector as far as possible;
		clock generator (Such as crystal oscillator or clock oscillator)Be as close as possible to the device using the clock;
		A decoupling capacitor shall be added between the power input pin of each integrated circuit and the ground(Single stone capacitor with good high frequency performance is generally used);When the circuit board space is dense, a tantalum capacitor can also be added around several integrated circuits.
		A discharge diode shall be added at the relay coil;
		The layout shall be balanced, dense and orderly, and shall not be top heavy or heavy
	Particular attention
		When placing components, the actual size of components must be considered(Area and height occupied),The relative position between components to ensure the electrical performance of the circuit board and the feasibility and convenience of production and installation. At the same time, on the premise of ensuring that the above principles can be reflected, the placement of components should be appropriately modified to make them neat and beautiful. The like components should be placed neatly and in the same direction, and should not be "scattered".
	wiring
		Wiring is generally divided into three realms
			First is buton, and then PCB The most basic requirements in design. If the lines are not connected and there is a flying line, it will be an unqualified board. It can be said that it has not been introduced yet.
			The second is the satisfaction of electrical performance. This is the standard to measure whether a printed circuit board is qualified. This is to carefully adjust the wiring after wiring to achieve the best electrical performance.
			Then there is beauty. If your wiring is connected, there is no place to affect the performance of electrical appliances, but at a glance, it is disordered in the past, coupled with colorful and colorful, even if your electrical performance is good, it is still a piece of garbage in the eyes of others. This brings great inconvenience to testing and maintenance.
	Wiring optimization and silk screen printing
		Generally, the time to optimize the routing is twice that of the initial routing. I don't think there is anything to modify, so I can lay copper(Place->polygon Plane). Copper laying and general ground wire laying(Pay attention to the separation of analog and digital),It may also be necessary to lay power supply when multilayer boards are used.
		For silk screen printing, pay attention not to be blocked by devices or removed by vias and pads. At the same time, the design should face up to the component surface, and the words at the bottom should be mirrored to avoid confusing the layer. 
	Network and DRC Inspection and structural inspection
		On the premise that the circuit schematic design is correct, the generated PCB Check the physical connection between the network file and the schematic network file(NETCHECK),The design shall be corrected in time according to the output document results to ensure the correctness of wiring connection relationship;
		After the network check passes correctly, the PCB Design for DRC Check and correct the design in time according to the output document results to ensure PCB Electrical performance of wiring. Finally, further research is needed PCB Check and confirm the mechanical installation structure.
	Plate making
	summary

PCB design is a test of mind. Whoever has dense mind and high experience, the designed board is good. Therefore, we should be extremely careful in design, fully consider various factors (for example, many people don't consider the convenience of maintenance and inspection), keep improving, and we will be able to design a good board

3D modeling and printing

Modeling tools
	SolidWorks
	3Dmax
	other
	Use that if you can
 Model printing
	There are quite a lot of ways. It still depends on 3 D Printer type
	Generally STL More files are used
 This aspect is mainly modeling, which must be designed in combination with actual requirements
 Document writing
 Mind map
 Planning, posters, videos, etc

Linux project

Basic knowledge

Linux Basic knowledge
	development
	Specific and advantages
	Application scenario
	common Linux System version
		CentOS
		Ubuntu
		other
Linux environment
	Construction method
		virtual machine
		Cloud server
		Online tools
		other
	Remote connection
		SSH
		Connection tool
			XShell
			MobaXterm
			FinalShell
Linux Fundamentals of operating system
	Operation of files and directories
		ls

			Displays a list of files and directories

		cd

			Switch directory

		pwd

			Displays the current working directory
		mkdir

			Create directory

		rmdir

			remove empty directories
		touch

			The time when an empty file was generated or changed

		cp

			Copy files or directories

		mv
			Move files or directories, rename files or directories
		rm
			Delete file or directory
		ln
			Create linked file
		find
			Find file
		file/stat
			View file type or file attribute information
		echo
			Redirect the content to the specified file, open if any, and create if none
		Pipeline command |
			Give the previous results to the following commands, for example:`ls -la | wc `,take ls Come on wc Command to count words
		redirect > It's overlay mode,>> Is the append mode
			For example:`echo "Java3y,zhen de hen xihuan ni" > qingshu.txt `Put the output on the left into the file on the right
	see file
		cat
			View text file contents
		more
			You can page it
		less
			It can not only page, but also easily search, rewind and other operations
		tail -10
			View the 10 lines at the end of the file
		head -20
			View the top 20 lines of the file
	system information 
		uname View system information
		hostname View host name
		cat/proc/cpuinfo see CPU information
		lsmod View loaded system modules
		top View system usage
		df View disk partitions
		du View directory usage
		lostat see I/O Usage
		free Display system memory
		env View environment variables
		uptime View the system running time, number of users and load
	system operation 
		shutdown Shut down
		reboot restart
		mount Mount equipment
		umount Uninstall device
	Manage users
		user management 
			useradd
				Add user
			usermod
				Modify user
			userdel
				delete user
		Group management
			groupadd
				add group
			groupmod
				Modify group
			groupdel
				delete group
		
			Batch add/Update a group of accounts: newusers
			Batch update user passwords: chpasswd
		Group member management:
			Add users to a standards group

gpasswd -a <User account name> <Group account name>

usermod -G <Group account name> <User account name>

Remove user from standard group

gpasswd -d <User account name> <Group account name>
		password management 
			
				modify /etc/login.defs Related configuration parameters
			
				passwd
			Set password aging for existing users:
				change
		Switch users
			su
			sudo
		User related commands:
			id: Displays the current of the user uid,gid And the list of groups to which the user belongs
			groups: Displays a list of groups to which the specified user belongs
			whoami: Displays the name of the current user
			w/who: Display login user and related information
			newgrp: It is used to convert the user's current group to the specified group account. The user must belong to the group before the command can be executed correctly
	Process management
		ps: Find out the information of the process
		nice and renice: Adjust the priority of the process
		kill: Kill process
		
		
		job management 
			jobs: List job numbers and names
			bg: 
			fg: Resume operation in the foreground
			ctrl+z: Temporarily stop a process
		Automated tasks
			at
			cron
		Management Daemon 
			chkconfig
			service 
			
	Packaging and compressing files
		compress
			gzip filename
			bzip2 filename
			tar -czvf filename
		decompression
			gzip -d filename.gz
			bzip2 -d filename.bz2
			tar -xzvf filename.tar.gz
	grep+regular expression 
		grep -n mystr myfile
			In file myfile Find containing strings in mystr Line of
		grep  '^[a-zA-Z]'  myfile
			display myfile All lines in which the first character is a letter
	Vi editor 
		Normal mode
			G
			ZZ
			ZQ
			/And?
			n
			yy
			p
			dd Delete a line of text
			u Cancels the last edit operation( undo)
		Insert mode
			use i or a or o Insert mode
			use esc Return to normal mode
		Command line mode
			w
			w
			wq
			q!
			q
		set up Vi environment
			set autoindent  indent,It is often used for programming
			set noautoindent remove indent
			set number Show line numbers when editing files
			set tabstop=value Sets the number of space characters to display tabs
			set Displays all options set
	Authority management
		To change the permissions of a file or directory: chmod
		Change the ownership (owner) of a file or directory: chown
		
		Set the default build mask for the file: umask
		File extension properties
			
	other
		
			ifconfig: View network interface information
			ifup/ifdown: Open or close the interface
		Temporary configuration related
			route Command: you can set the kernel routing table temporarily
			hostname Command: you can modify the host name temporarily
			sysctl Command: you can temporarily turn on the packet forwarding of the kernel
			
		
			ifconfig Detect network interface configuration

route Detect routing configuration

ping Detect network connectivity

netstat View network status

lsof View assignments IP and/Or the current operation of the process on the port

host/dig/nslookup testing DNS analysis

traceroute The router passed by the destination host is detected

tcpdump Displays the status of local network traffic
		Install software
			yum
			rpm
			wget
	vim
		Basic operating mode
			Command mode 
				Move Cursor 
					Shift left
					Shift right
					Move down
					 Move up
					Move the cursor to the beginning of the file
					Move the cursor to the end of the file
					Move the cursor to the beginning of the line
					Move cursor to end of line
					Jump to line 123
				delete
					Delete the next character after the cursor,amount to Del
					 Deletes the previous character of the cursor,amount to Backspace
					Delete the word at the beginning of the cursor,Contains the character of the cursor
						The cursor must move over the first character of the deleted word
					Delete all contents of the line before the cursor
					 Delete all contents of the line after the cursor
					Delete the line where the cursor is located
					Delete 10 rows
					It's not really deleted, it's actually cut
				Undo operation
					Undo step by step
					Anti revocation
				Copy paste
					Copy current row
					Copy 10 rows from the current row
					Open a new line down at the cursor position,paste
					Open a new line up at the cursor position,paste
				Visual Modes 
					Move by word
					Move by line
					How do I move the cursor?
					How do I copy the selected content?
				Find operation
					Find backward from the cursor position hello
					Look forward from the cursor position hello
					The word can be found by using which symbol on the word to be queried
					Switch position?
				Replace operation
					Replace the character in the
				Text line movement
					Move text line right
					Move text line left
				see Man Page
					Move the cursor over the function
					See Chapter 3 ManPage
			Text input mode
				Enter input mode
					Insert a character before the cursor
					Insert line beginning
					Insert one character after cursor
					Insert row not
					Open a new line down,Insert line beginning
					Open a new line up,Insert line beginning
					Delete the character of the cursor
					Delete current row
			Last line mode
				command
					Line jump
						Jump to line 123
					replace
						Replace one line
							The first in the current row abc Replace with 123
							The in the current row abc Replace all with 123
						Replace all
							The first of all rows abc Replace with 123
							All rows abc Replace all with 123
						Replace specified row
							Will 10-30 In line abc Replace all with 123
					implement shell command
		Split screen operation
			Last line mode
				Horizontal split screen
				Vertical split screen
				Split screen display of two different files
				operation
					Save and exit all screens
					Save and exit the screen where the cursor is located
					flip screens
		vim make IDE
			System level profile directory:
			User level profile directory:
		Command mode
			
		Command mode
		Text mode
		Last line mode
		complete
		file
		complete
Linux Network programming
	Computer network knowledge supplement
		Introduction to computer network
		Application layer protocol
		Transport layer agreement: TCP And UDP
		Network layer protocol
		Data link layer protocol
	TCP Analysis of network communication
		Three handshakes and four handshakes
		TCP flow control
		TCP congestion avoidance 
		TCP state transition 
	socket Network programming interface
		socket Creation and closing of
		server End: bind,listen,accept
		Client End: connect
		Data sending and receiving: send,recv
	UDP Programming implementation
		stay UDP Use on connect
	be based on CS Modelled TCP Design and implementation of customer service terminal
	P2P Implementation of model network service
	HTTP And BS Model
	Simple network concurrency model
		Based on multithreading and multi process
		ordinary IO Multiplexing mechanism
	Project practice
		Server cluster monitoring system
Linux System programming
	Linux Introduction to system programming
		Command line parameter parsing
		Macro implementation for debugging and testing
		General function package
	file I/O
		Opening, closing, reading and writing of files
		Blocking and non blocking IO
		synchronization IO
		Kernel Insider: virtual file system
	buffer I/O
		standard I/O
		Opening, closing and reading / writing of stream
		Control buffer
		Thread safe: locking files
	Multiprocess programming
		Process system: process ID,Parent-child process relationship
		Run a new process: fork,exec
		Terminate process
		Wait for the child process to exit
		Special process
			Zombie process
			Orphan process
			Daemon
	Advanced process management
		Process scheduling
		Fully fair scheduling algorithm
		Principle and implementation of real-time system
	Implementation of thread pool
	Process and communication IPC
		File based simple interprocess communication
		Shared memory: mutex, condition variable
		Pipes: anonymous and named pipes
		Shared storage mapping
		Message queue
		Semaphore
		socket
	Multithreaded programming
		Comparison of threads and processes
		Thread model
		thread  API
		Thread mode
			A connection corresponds to a thread
			event driven 
		Concurrency, parallelism and contention
		Synchronization: mutual exclusion and deadlock
	signal
		Basic signal management
		Send signal
		Signal set
		Advanced signal management
	time
		Representation of time
		Sleep and waiting
		timer
	senior IO
		Dispersion and aggregation IO
		IO Multiplexing
			select
			poll
			epoll
		IO Scheduler and IO performance
	terminal IO programming
		Mode of terminal driver
		ncurses Library usage
	Project practice
		Realize your own shell

Actual combat project

	Client/Server
		introduce
			Socket It is one of the ways of interprocess communication and interprocess communication. The processes mentioned here are not necessarily on the same machine, but also on different machines connected through the network. As long as they have established socket Then data can be exchanged between machines in two directions until the connection is disconnected.
		socket Establishment of
			When we come into contact with the actual code API Before, we should understand the basic connection mode.
			Note left of server: Create a monitor socket And wait for the client to connect
			Note right of client: Create a client socket And try to connect server
			Note left of server: Accept from client Connection request for
			server->client: Sending and receiving data
			client->server: Receiving and sending data
			Note left of server: Close current connection
			Note right of client: Close current connection
		Connection steps
			first server You need to create a listening socket,wait for client Connection request for.
			client Create a socket,Try to connect server. 
			server accept client To establish a connection between the two.
			Data exchange, two-way communication.
			Either party can disconnect, and the connection will be automatically destroyed after disconnection.
		Client
			Through system function socket()Create a socket. 
			Through system function connect()towards server Terminal socket Initiate a request.
			There are many ways to exchange data, the simplest of which is to use system functions read(),write(). 
		Server
			Through system function socket()Create a socket. 
			Through system function bind()Bind this socket reach server On one of the ports.
			Through system function listen()Listen to this socket. 
			When the supervisor hears that another request is coming, it passes the system function accept()Accept a request. This function blocks io Until the two are completely disconnected.
			Exchange data.
		socket Type of
			Be a socket After being established, the processes need to describe the protocols and protocols used socket type. Only both sides of the communication have the same type And agreements.
			At present, there are two types of protocols widely used, namely Unix File system protocol(Unix domain),Internet Network protocol(Internet domain). Correspondingly, they have their own characteristics. use Unix domain Both parties use a public file system for communication Internet domain The processes are located on different hosts, and they communicate through the network.
			use Unix domain of socket An address is essentially a record of the file system and is itself a string.
			use Interner domain of socket It consists of two parts, one of which is the host IP The address, in part socket Port number bound to. Generally, ports with lower port numbers are used for special purposes. For example, ports with port numbers of 80 are provided http Service.
			Currently widely used socket There are also two types, one is flow socket(stream sockets),One is datagram socket(datagram sockets). stream socket Dealing with communication is like dealing with a continuous stream of bytes like pipelining datagram sockets You need to read complete characters. Usually, a character consists of several bytes.
			Built in use TCP Based on the protocol, this is a reliable byte stream oriented protocol. Another protocol is UDP Protocol, which is an unreliable character oriented protocol.
		Create step
			establish socket
					socket_desc = socket(AF_INET, SOCK_STREAM, 0);
	if (-1 == socket_desc) {
		perror("cannot create socket");
		exit(1);
	}
			Set information for remote server
				server.sin_addr.s_addr = inet_addr("127.0.0.1");
server.sin_family = AF_INET;
server.sin_port = htons(80);
			connect
					if (connect(socket_desc, (struct sockaddr *)&server, sizeof(server)) < 0) {
		perror("cannot connect");
		return 0;
	}
			When the server accepts the request, a connection is established
		Function description
			connect()function
				brief introduction
					connect()The function makes a request to the server to establish a connection.
				parameter
					int sockfd	=> socket Descriptor for
					const struct sockaddr *addr	=> sockaddr Structure, general socket address
					socklen_taddrlen	=> socket The length of the descriptor.
					struct sockaddr Is a general socket address, and struct sockaddr_in then is Internet The address form of socket in the environment is the same in length, both of which are 16 bytes. The two are parallel structures, pointing to sockaddr_in The pointer to the structure can also point to sockaddr. In general, you need to sockaddr_in Structure cast to sockaddr Structure is then passed into the system call function.
				In addition, in the code htons()The function converts host data into the order of network bytes
			send()function
			recv()function
			htons()function
			socket()function
			introduce
				https://www.cnblogs.com/tingyugetc/p/6253041.html
				There are a lot of information on the Internet. If you search, there will be a lot
	Realize your own shell
		website
			https://blog.csdn.net/OCTODOG/article/details/70942194
			https://blog.csdn.net/qq_44049351/article/details/99702807
	Server cluster monitoring system
		website
			https://blog.51cto.com/wangfx/1955766
		The information on the Internet is miscellaneous, so we should learn to distinguish
	Build a website

Expansion article

FreeROTS Embedded real-time operating system
	website
		Official website
			https://www.freertos.org
		https://zhuanlan.zhihu.com/p/90608412
		https://www.pcworld.com/article/460666/tesla_cto_talks_model_s_batteries_and_incar_linux.html
	video
		https://www.bilibili.com/video/BV1C5411M7gK?from=search&seid=5307118440328018083&spm_id_from=333.337.0.0
		stay B There are many station searches, including weidongshan, punctual atom, etc
	How to transplant FreeROTS
Linux real-time operating system 
	brief introduction
		RTLinux(AReal-Time Linux,Also known as real time Linux)yes Linux A real-time operating system in.
	website
		https://zhuanlan.zhihu.com/p/147563274
ucos Real time multitasking operating system
	website
		https://blog.csdn.net/ideal121/article/details/119571307
ARM
	website
		https://blog.csdn.net/weixin_38717634/article/details/112860225?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163324583316780274116753%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=163324583316780274116753&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_click~default-2-112860225.pc_search_all_es&utm_term=ARM&spm=1018.2226.3001.4187
ESP
	website
		https://blog.csdn.net/wdscq1234/article/details/52705458?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163324798016780261927900%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=163324798016780261927900&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-52705458.pc_search_all_es&utm_term=ESP&spm=1018.2226.3001.4187
 other

summary

It's difficult for each party to go deep. It's recommended to practice and summarize more. I don't understand a lot of content, but I will continue to learn in the future, strengthen consolidation and expand in depth
 It is recommended to watch videos and practice with them. After mastering the basic knowledge, you should practice and think more. The foundation is very important. Don't study profound knowledge without foundation


Tags: C++ Embedded system IoT Software development

Posted on Sun, 03 Oct 2021 22:49:00 -0400 by oaskedal