Skip to content

Commit a053d79

Browse files
committed
Initial push of version 1
1 parent d5c8932 commit a053d79

12 files changed

Lines changed: 700 additions & 0 deletions

File tree

Arduino/LCD1602/LCD1602.ino

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Arduino System Display for LCD1602
2+
#include <LiquidCrystal.h>// include the library code
3+
4+
int refresh_rate = 250; // Initial refresh rate, configurable from the PC app.
5+
6+
LiquidCrystal lcd(4, 6, 10, 11, 12, 13);
7+
8+
/*********************************************************/
9+
byte serial_buffer[10] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
10+
11+
byte cur_cpu = 0;
12+
byte cur_memory = 0;
13+
14+
void setup()
15+
{
16+
lcd.begin(16, 2); // set up the LCD's number of columns and rows
17+
18+
// PIN 3 is connected to V0 on the LCD and set to 100 which is a good contrast value.
19+
pinMode(3, OUTPUT);
20+
analogWrite(3, 100);
21+
22+
Serial.begin(9600);
23+
}
24+
25+
void printAt(String str, int startX, int startY)
26+
{
27+
for(int i = 0; i < str.length(); i++)
28+
{
29+
lcd.setCursor(startX + i,startY);
30+
lcd.print(str.charAt(i));
31+
}
32+
}
33+
/*********************************************************/
34+
void loop()
35+
{
36+
while(Serial.available() > 0)
37+
{
38+
byte command = Serial.read();
39+
40+
switch(command)
41+
{
42+
// Update refresh rate
43+
// Computer sends an int which will be the new refresh rate
44+
case 100:
45+
{
46+
Serial.readBytes(serial_buffer, 4);
47+
refresh_rate = *(int *)serial_buffer;
48+
break;
49+
}
50+
51+
// Update CPU and Memory
52+
// Computer sends a byte per component, already in percentage range.
53+
case 101:
54+
Serial.readBytes(serial_buffer, 2);
55+
cur_cpu = serial_buffer[1];
56+
cur_memory = serial_buffer[2];
57+
break;
58+
}
59+
}
60+
61+
lcd.clear();
62+
printAt("CPU", 1, 0);
63+
printAt("Memory", 1, 1);
64+
65+
String cpu_str = String(cur_cpu);
66+
cpu_str = cpu_str + "%";
67+
68+
// Print CPU value with calculated right align
69+
printAt(cpu_str, 11 + (3 - cpu_str.length()), 0);
70+
71+
String mem_str = String(cur_memory);
72+
mem_str = mem_str + "%";
73+
74+
// Print Memory value with calculated right align
75+
printAt(mem_str, 11 + (3 - mem_str.length()), 1);
76+
77+
delay(refresh_rate);
78+
}
79+
/************************************************************/
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29920.165
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArduinoSystemDisplay", "ArduinoSystemDisplay\ArduinoSystemDisplay.csproj", "{D948D07A-B1DB-431C-8758-2B9908FE1431}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{D948D07A-B1DB-431C-8758-2B9908FE1431}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{D948D07A-B1DB-431C-8758-2B9908FE1431}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{D948D07A-B1DB-431C-8758-2B9908FE1431}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{D948D07A-B1DB-431C-8758-2B9908FE1431}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {0DDB0B78-9E9E-42C3-8621-4990A959D8C4}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{D948D07A-B1DB-431C-8758-2B9908FE1431}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>SerialDisplay</RootNamespace>
10+
<AssemblyName>SerialDisplay</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
<PublishUrl>publish\</PublishUrl>
16+
<Install>true</Install>
17+
<InstallFrom>Disk</InstallFrom>
18+
<UpdateEnabled>false</UpdateEnabled>
19+
<UpdateMode>Foreground</UpdateMode>
20+
<UpdateInterval>7</UpdateInterval>
21+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
22+
<UpdatePeriodically>false</UpdatePeriodically>
23+
<UpdateRequired>false</UpdateRequired>
24+
<MapFileExtensions>true</MapFileExtensions>
25+
<ApplicationRevision>0</ApplicationRevision>
26+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
27+
<IsWebBootstrapper>false</IsWebBootstrapper>
28+
<UseApplicationTrust>false</UseApplicationTrust>
29+
<BootstrapperEnabled>true</BootstrapperEnabled>
30+
</PropertyGroup>
31+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
32+
<PlatformTarget>AnyCPU</PlatformTarget>
33+
<DebugSymbols>true</DebugSymbols>
34+
<DebugType>full</DebugType>
35+
<Optimize>false</Optimize>
36+
<OutputPath>bin\Debug\</OutputPath>
37+
<DefineConstants>DEBUG;TRACE</DefineConstants>
38+
<ErrorReport>prompt</ErrorReport>
39+
<WarningLevel>4</WarningLevel>
40+
</PropertyGroup>
41+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
42+
<PlatformTarget>AnyCPU</PlatformTarget>
43+
<DebugType>pdbonly</DebugType>
44+
<Optimize>true</Optimize>
45+
<OutputPath>bin\Release\</OutputPath>
46+
<DefineConstants>TRACE</DefineConstants>
47+
<ErrorReport>prompt</ErrorReport>
48+
<WarningLevel>4</WarningLevel>
49+
</PropertyGroup>
50+
<PropertyGroup>
51+
<StartupObject />
52+
</PropertyGroup>
53+
<ItemGroup>
54+
<Reference Include="System" />
55+
<Reference Include="System.Core" />
56+
<Reference Include="System.Drawing" />
57+
<Reference Include="System.Windows.Forms" />
58+
<Reference Include="System.Xml.Linq" />
59+
<Reference Include="System.Data.DataSetExtensions" />
60+
<Reference Include="Microsoft.CSharp" />
61+
<Reference Include="System.Data" />
62+
<Reference Include="System.Net.Http" />
63+
<Reference Include="System.Xml" />
64+
</ItemGroup>
65+
<ItemGroup>
66+
<Compile Include="Program.cs" />
67+
<Compile Include="Properties\AssemblyInfo.cs" />
68+
<Compile Include="Properties\Resources.Designer.cs">
69+
<AutoGen>True</AutoGen>
70+
<DesignTime>True</DesignTime>
71+
<DependentUpon>Resources.resx</DependentUpon>
72+
</Compile>
73+
</ItemGroup>
74+
<ItemGroup>
75+
<None Include="App.config" />
76+
</ItemGroup>
77+
<ItemGroup>
78+
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
79+
<Visible>False</Visible>
80+
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
81+
<Install>true</Install>
82+
</BootstrapperPackage>
83+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
84+
<Visible>False</Visible>
85+
<ProductName>.NET Framework 3.5 SP1</ProductName>
86+
<Install>false</Install>
87+
</BootstrapperPackage>
88+
</ItemGroup>
89+
<ItemGroup>
90+
<EmbeddedResource Include="Properties\Resources.resx">
91+
<Generator>ResXFileCodeGenerator</Generator>
92+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
93+
</EmbeddedResource>
94+
</ItemGroup>
95+
<ItemGroup>
96+
<None Include="Resources\AppIcon.ico" />
97+
</ItemGroup>
98+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
99+
</Project>

0 commit comments

Comments
 (0)