diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..6b61141 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,6 @@ +{ + "ExpandedNodes": [ + "" + ], + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000..c85c936 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/Source/.vs/ArduinoDriver/v15/Server/sqlite3/db.lock b/Source/.vs/ArduinoDriver/v15/Server/sqlite3/db.lock new file mode 100644 index 0000000..e69de29 diff --git a/Source/.vs/ArduinoDriver/v15/Server/sqlite3/storage.ide b/Source/.vs/ArduinoDriver/v15/Server/sqlite3/storage.ide new file mode 100644 index 0000000..56758a8 Binary files /dev/null and b/Source/.vs/ArduinoDriver/v15/Server/sqlite3/storage.ide differ diff --git a/Source/.vs/ArduinoDriver/v15/Server/sqlite3/storage.ide-shm b/Source/.vs/ArduinoDriver/v15/Server/sqlite3/storage.ide-shm new file mode 100644 index 0000000..431dbb9 Binary files /dev/null and b/Source/.vs/ArduinoDriver/v15/Server/sqlite3/storage.ide-shm differ diff --git a/Source/.vs/ArduinoDriver/v15/Server/sqlite3/storage.ide-wal b/Source/.vs/ArduinoDriver/v15/Server/sqlite3/storage.ide-wal new file mode 100644 index 0000000..072c9c5 Binary files /dev/null and b/Source/.vs/ArduinoDriver/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Source/ArduinoDriver.BasicReadWrite/App.config b/Source/ArduinoDriver.BasicReadWrite/App.config new file mode 100644 index 0000000..8227adb --- /dev/null +++ b/Source/ArduinoDriver.BasicReadWrite/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Source/ArduinoDriver.BasicReadWrite/ArduinoDriver.Samples.BasicReadWrite.csproj b/Source/ArduinoDriver.BasicReadWrite/ArduinoDriver.Samples.BasicReadWrite.csproj new file mode 100644 index 0000000..e0c2459 --- /dev/null +++ b/Source/ArduinoDriver.BasicReadWrite/ArduinoDriver.Samples.BasicReadWrite.csproj @@ -0,0 +1,98 @@ + + + + + Debug + AnyCPU + {C18462ED-3D50-4EF5-AD57-F57B61BC1E48} + WinExe + AutoStillDotNet + AutoStillDotNet + v4.5.2 + 512 + true + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\ArduinoDriver.2.4.6\lib\net40\ArduinoDriver.dll + + + ..\packages\ArduinoUploader.3.1.0\lib\net40\ArduinoUploader.dll + + + ..\packages\IntelHexFormatReader.2.2.3\lib\net45\IntelHexFormatReader.dll + + + ..\packages\NLog.4.4.10\lib\net45\NLog.dll + + + ..\packages\SerialPortStream.2.1.2\lib\net45\RJCP.SerialPortStream.dll + + + + + + + + + + + + + Form + + + Main.cs + + + + + Main.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/Source/ArduinoDriver.BasicReadWrite/Main.Designer.cs b/Source/ArduinoDriver.BasicReadWrite/Main.Designer.cs new file mode 100644 index 0000000..089c12f --- /dev/null +++ b/Source/ArduinoDriver.BasicReadWrite/Main.Designer.cs @@ -0,0 +1,73 @@ +namespace AutoStillDotNet +{ + partial class Main + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); + this.SuspendLayout(); + // + // chart1 + // + chartArea1.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea1); + legend1.Name = "Legend1"; + this.chart1.Legends.Add(legend1); + this.chart1.Location = new System.Drawing.Point(217, 105); + this.chart1.Name = "chart1"; + series1.ChartArea = "ChartArea1"; + series1.Legend = "Legend1"; + series1.Name = "Series1"; + this.chart1.Series.Add(series1); + this.chart1.Size = new System.Drawing.Size(300, 300); + this.chart1.TabIndex = 0; + this.chart1.Text = "chart1"; + // + // Main + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.SystemColors.ControlDarkDark; + this.ClientSize = new System.Drawing.Size(780, 527); + this.Controls.Add(this.chart1); + this.Name = "Main"; + this.Text = "AutoStill"; + ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + } +} + diff --git a/Source/ArduinoDriver.BasicReadWrite/Main.cs b/Source/ArduinoDriver.BasicReadWrite/Main.cs new file mode 100644 index 0000000..e532340 --- /dev/null +++ b/Source/ArduinoDriver.BasicReadWrite/Main.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AutoStillDotNet +{ + public partial class Main : Form + { + public Main() + { + InitializeComponent(); + } + } +} diff --git a/Source/ArduinoDriver.BasicReadWrite/Main.resx b/Source/ArduinoDriver.BasicReadWrite/Main.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Source/ArduinoDriver.BasicReadWrite/Main.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Source/ArduinoDriver.BasicReadWrite/Program.cs b/Source/ArduinoDriver.BasicReadWrite/Program.cs new file mode 100644 index 0000000..710275f --- /dev/null +++ b/Source/ArduinoDriver.BasicReadWrite/Program.cs @@ -0,0 +1,76 @@ +using System; +using ArduinoDriver; +using ArduinoDriver.SerialProtocol; +using ArduinoUploader.Hardware; +using System.Diagnostics; +using System.Windows.Forms; + + +namespace AutoStillDotNet +{ + + static class Program + { + + + [STAThread] + static void Main() + { + + //Declare the arduino itself -- Note the COM Port and Model Specifications -- If no COM port is specified the program + //searches for a single available COM Port. If there are multiple devices it must be specified + var driver = new ArduinoDriver.ArduinoDriver(ArduinoModel.Mega2560, true); + //var driver = new ArduinoDriver.ArduinoDriver(ArduinoModel.Leonardo, "COM6", true); + //var driver = new ArduinoDriver.ArduinoDriver(ArduinoModel.NanoR3, "COM5", true); + + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Declare all your things and assign each one a pin number (LEDS, Sensors, Relays etc) + //Digital Outputs -- LEDS with positive lead connected to pins 22 and 23 + byte LED1 = 22; + byte LED2 = 23; + + //Digital Inputs + byte Switch = 24; //A switch connected from 5v or 3.3v to Pin 24 + + //Analog Inputs + byte TempSensor = 54; //Temperature sensor + byte VacuumSensor = 55; // Vacuum sensor (Or any resistance based sensor really) + + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Setup the Arduino itself by setting the pinmodes + //Digital outputs + driver.Send(new PinModeRequest(LED1, PinMode.Output)); + driver.Send(new PinModeRequest(LED2, PinMode.Output)); + + //Digial inputs + driver.Send(new PinModeRequest(Switch, PinMode.Input)); + + //Sensor Inputs + driver.Send(new PinModeRequest(TempSensor, PinMode.Input)); + driver.Send(new PinModeRequest(VacuumSensor, PinMode.Input)); + + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //Tell the arduino to read and write + driver.Send(new DigitalWriteRequest(LED1, DigitalValue.High)); //Turn LED 1 and 2 On + driver.Send(new DigitalWriteRequest(LED2, DigitalValue.High)); + + //Read from the sensors and write the value to a variable + string Temperature = driver.Send(new AnalogReadRequest(TempSensor)).PinValue.ToString(); + string Pressure = driver.Send(new AnalogReadRequest(VacuumSensor)).PinValue.ToString(); + + //Use a switch connected from 5v to Pin24 to turn off LED2 + while (driver.Send(new DigitalReadRequest(Switch)).PinValue.ToString() == "Low") + { + System.Threading.Thread.Sleep(1000); + } + driver.Send(new DigitalWriteRequest(LED2, DigitalValue.Low)); + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Main()); + } + } +} diff --git a/Source/ArduinoDriver.BasicReadWrite/Properties/AssemblyInfo.cs b/Source/ArduinoDriver.BasicReadWrite/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e7b4609 --- /dev/null +++ b/Source/ArduinoDriver.BasicReadWrite/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("AutoStillDotNet")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AutoStillDotNet")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c18462ed-3d50-4ef5-ad57-f57b61bc1e48")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Source/ArduinoDriver.BasicReadWrite/Properties/Resources.Designer.cs b/Source/ArduinoDriver.BasicReadWrite/Properties/Resources.Designer.cs new file mode 100644 index 0000000..d7abe12 --- /dev/null +++ b/Source/ArduinoDriver.BasicReadWrite/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AutoStillDotNet.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AutoStillDotNet.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Source/ArduinoDriver.BasicReadWrite/Properties/Resources.resx b/Source/ArduinoDriver.BasicReadWrite/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Source/ArduinoDriver.BasicReadWrite/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Source/ArduinoDriver.BasicReadWrite/Properties/Settings.Designer.cs b/Source/ArduinoDriver.BasicReadWrite/Properties/Settings.Designer.cs new file mode 100644 index 0000000..50b7d69 --- /dev/null +++ b/Source/ArduinoDriver.BasicReadWrite/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AutoStillDotNet.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Source/ArduinoDriver.BasicReadWrite/Properties/Settings.settings b/Source/ArduinoDriver.BasicReadWrite/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Source/ArduinoDriver.BasicReadWrite/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Source/ArduinoDriver.BasicReadWrite/packages.config b/Source/ArduinoDriver.BasicReadWrite/packages.config new file mode 100644 index 0000000..0112ed6 --- /dev/null +++ b/Source/ArduinoDriver.BasicReadWrite/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Source/ArduinoDriver.Samples.SMBTune/App.config b/Source/ArduinoDriver.Samples.SMBTune/App.config index cae34e3..3d865ad 100644 --- a/Source/ArduinoDriver.Samples.SMBTune/App.config +++ b/Source/ArduinoDriver.Samples.SMBTune/App.config @@ -7,7 +7,7 @@ - + diff --git a/Source/ArduinoDriver.sln b/Source/ArduinoDriver.sln index d22068c..b7433ab 100644 --- a/Source/ArduinoDriver.sln +++ b/Source/ArduinoDriver.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.168 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Library", "Library", "{21F7D77A-B524-4E67-B032-5AA9A37BB107}" EndProject @@ -18,6 +18,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{ED0AB2 .nuget\NuGet.targets = .nuget\NuGet.targets EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArduinoDriver.Samples.BasicReadWrite", "ArduinoDriver.BasicReadWrite\ArduinoDriver.Samples.BasicReadWrite.csproj", "{C18462ED-3D50-4EF5-AD57-F57B61BC1E48}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -32,6 +34,10 @@ Global {0E5DBA42-2330-4C41-9826-146C3BBC367D}.Debug|Any CPU.Build.0 = Debug|Any CPU {0E5DBA42-2330-4C41-9826-146C3BBC367D}.Release|Any CPU.ActiveCfg = Release|Any CPU {0E5DBA42-2330-4C41-9826-146C3BBC367D}.Release|Any CPU.Build.0 = Release|Any CPU + {C18462ED-3D50-4EF5-AD57-F57B61BC1E48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C18462ED-3D50-4EF5-AD57-F57B61BC1E48}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C18462ED-3D50-4EF5-AD57-F57B61BC1E48}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C18462ED-3D50-4EF5-AD57-F57B61BC1E48}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -39,5 +45,9 @@ Global GlobalSection(NestedProjects) = preSolution {1FE32CD3-938F-40A7-B0A5-75CF0A7254D7} = {21F7D77A-B524-4E67-B032-5AA9A37BB107} {0E5DBA42-2330-4C41-9826-146C3BBC367D} = {CA9C6727-9E34-4382-ABA3-2ECED485DC51} + {C18462ED-3D50-4EF5-AD57-F57B61BC1E48} = {CA9C6727-9E34-4382-ABA3-2ECED485DC51} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {08A91FA5-E915-4342-AF5A-7A186BECC0BC} EndGlobalSection EndGlobal diff --git a/Source/ArduinoDriver/ArduinoDriver.csproj b/Source/ArduinoDriver/ArduinoDriver.csproj index aa0f8f8..6d63c7e 100644 --- a/Source/ArduinoDriver/ArduinoDriver.csproj +++ b/Source/ArduinoDriver/ArduinoDriver.csproj @@ -32,23 +32,28 @@ 4 - - ..\packages\ArduinoUploader.3.1.0\lib\net452\ArduinoUploader.dll + + ..\packages\ArduinoUploader.3.2.0\lib\net452\ArduinoUploader.dll - False ..\packages\IntelHexFormatReader.2.2.1\lib\net452\IntelHexFormatReader.dll + - False - ..\packages\NLog.4.4.10\lib\net45\NLog.dll + ..\packages\NLog.4.5.11\lib\net45\NLog.dll - - False - ..\packages\SerialPortStream.2.1.2\lib\net45\RJCP.SerialPortStream.dll + + ..\packages\SerialPortStream.2.2.0\lib\net45\RJCP.SerialPortStream.dll + + + + + + + diff --git a/Source/ArduinoDriver/app.config b/Source/ArduinoDriver/app.config index a4be1c7..ce71187 100644 --- a/Source/ArduinoDriver/app.config +++ b/Source/ArduinoDriver/app.config @@ -4,7 +4,7 @@ - + diff --git a/Source/ArduinoDriver/packages.config b/Source/ArduinoDriver/packages.config index 549f37e..88bd605 100644 --- a/Source/ArduinoDriver/packages.config +++ b/Source/ArduinoDriver/packages.config @@ -1,7 +1,7 @@  - - - - + + + + \ No newline at end of file