Skip to content

可以把串口输出显示在1602 LCD上的简单程序

Notifications You must be signed in to change notification settings

dasudiy/LCDDisplay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LCDDisplay

可以将串口输出显示在1602LCD的简单程序。使用esp8266 nodemcu开发板。

  • \r0\r 清屏
  • \r1\r 打开背光
  • \r2\r 关闭背光

示例

void Main()
{
	PerformanceCounter cpuCounter;
	PerformanceCounter ramCounter;

	cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
	ramCounter = new PerformanceCounter("Memory", "Available MBytes");

	var port = new System.IO.Ports.SerialPort("COM6", 115200);
	port.Open();
	using (var writer = new StreamWriter(port.BaseStream))
	{
		writer.Write("\r0\r");
		writer.Flush();
		while (true)
		{
			writer.Write("\r0\r");
			writer.Write($"CPU:{cpuCounter.NextValue().To<int>()}%\nMEM:{ramCounter.NextValue().To<int>()}MB\n");			
			writer.Flush();
			Thread.Sleep(1000);
		}
		port.Close();

	}
}

// You can define other methods, fields, classes and namespaces here

demo.jpg

About

可以把串口输出显示在1602 LCD上的简单程序

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages