Stap 6: De C# codes...
// c# program to switch on the lights using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO.Ports; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { SerialPort sp= new SerialPort(); sp.PortName = "com4" // write your com port connected to arduino sp.BaudRate=9600; sp.Open(); sp.Write("d"); sp.Close(); } } }
Deze die het uitschakelen van de lichten.
// c# program to switch off the lightsusing System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO.Ports; using System.IO;namespace ConsoleApplication1 { class Program { static void Main(string[] args) { SerialPort sp= new SerialPort(); sp.PortName = "com4" // write your com port connected to arduino sp.BaudRate=9600; sp.Open(); sp.Write("a"); sp.Close(); } } } Type both the projects separately Type => Build => take the .exe fileyou can get the .exe file fromDocuments/Visual Studio/Projects/<project name>/<project name>/bin/Debug/<project name>.exe for both the off and on, bring two exe files and place them somewhere u are comfortable.