1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
using System; using System.Collections.Generic; using System.Text; namespace UsingTecnosUR050Driver { using IToolS.Data; using IToolS.Data.Base; using IToolS.Components; using IToolS.Components.Communication; using IToolS.Components.IOServers; class Program { static void Main(string[] args) { ComponentBase.RaiseEventsOnMainThread = false; IOServer ioServer = new IOServer() { Name = "UR050" }; ioServer.AdvancedProperties.Add(new AdvancedProperty("CommPort", 8)); ioServer.AdvancedProperties.Add(new AdvancedProperty("BaudRate", 57600)); Variable variable = new Variable() { Area = "VV", Address = "10" }; variable.VariableType = VariableTypeConverter.Long; variable.Changed += delegate(Object sender, ChangedEventArgs e) { Console.WriteLine("new value: {0}", e.NewValue); }; Group gruop = new Group(); gruop.Add(variable); Client client = new Client() { IOServer = ioServer, Group = gruop }; client.Start(); Console.WriteLine("Press ENTER to exit"); Console.ReadLine(); client.Stop(); ioServer.Deactivate(); } } } |