{"id":21129516,"url":"https://github.com/guorg/gu.twincat","last_synced_at":"2025-07-09T00:32:20.295Z","repository":{"id":37985231,"uuid":"228644718","full_name":"GuOrg/Gu.TwinCat","owner":"GuOrg","description":"For communication with BeckHoff TwinCAT PLC","archived":false,"fork":false,"pushed_at":"2023-12-25T16:14:17.000Z","size":168,"stargazers_count":4,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-26T07:08:22.359Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GuOrg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-12-17T15:21:48.000Z","updated_at":"2024-01-12T18:11:26.000Z","dependencies_parsed_at":"2023-12-14T10:56:26.064Z","dependency_job_id":"78fadd1d-28b0-4e3b-bca9-a62061573af8","html_url":"https://github.com/GuOrg/Gu.TwinCat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuOrg%2FGu.TwinCat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuOrg%2FGu.TwinCat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuOrg%2FGu.TwinCat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuOrg%2FGu.TwinCat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GuOrg","download_url":"https://codeload.github.com/GuOrg/Gu.TwinCat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225473336,"owners_count":17479767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T05:24:38.790Z","updated_at":"2024-11-20T05:24:39.304Z","avatar_url":"https://github.com/GuOrg.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gu.TwinCat\nFor communication with Beckhoff TwinCAT PLC\n\n## Sample\n\n```cs\npublic sealed class Plc : IDisposable\n{\n    private readonly AdsClient client;\n    private readonly ReadFromAdsSymbol\u003cint, int\u003e value3 = SymbolFactory.ReadInt32(\"Plc.Value3\");\n    private readonly ReadFromAdsSymbol\u003cfloat, Angle\u003e value4 = SymbolFactory.ReadSingle(\"Plc.Value4\", x =\u003e Angle.FromDegrees(x));\n    private readonly WriteToAdsSymbol\u003cint, int\u003e value5 = SymbolFactory.WriteInt32(\"Plc.Value5\");\n    private readonly WriteToAdsSymbol\u003cfloat, Angle\u003e value6 = SymbolFactory.WriteSingle\u003cAngle\u003e(\"Plc.Value6\", x =\u003e x.Degrees);\n\n    public Plc()\n    {\n        this.client = new AdsClient(\n            new AutoReconnectSettings(\n                address: new AmsAddress(\"1.2.3.4.5.6\", 851),\n                reconnectInterval: AdsTimeSpan.FromSeconds(1),\n                inactiveSymbolHandling: InactiveSymbolHandling.Throw));\n\n        this.Subscription1 = this.client.Subscribe(\n            SymbolFactory.ReadInt32(\"Plc.Value1\"),\n            AdsTransMode.OnChange,\n            AdsTimeSpan.FromMilliseconds(100));\n\n        this.Subscription2 = this.client.Subscribe(\n            SymbolFactory.ReadSingle(\n                \"Plc.Value2\",\n                x =\u003e Angle.FromDegrees(x)),\n            AdsTransMode.OnChange,\n            AdsTimeSpan.FromMilliseconds(100));\n    }\n\n    public Subscription\u003cint, int\u003e Subscription1 { get; }\n\n    public Subscription\u003cfloat, Angle\u003e Subscription2 { get; }\n\n    public int Value3() =\u003e this.client.Read(this.value3);\n\n    public Angle Value4() =\u003e this.client.Read(this.value4);\n\n    public void SetValue5(int value) =\u003e this.client.Write(this.value5, value);\n\n    public void SetValue6(Angle value) =\u003e this.client.Write(this.value6, value);\n\n    public void Dispose()\n    {\n        this.client.Dispose();\n        this.Subscription1.Dispose();\n        this.Subscription2.Dispose();\n    }\n}\n\npublic struct Angle\n{\n    public readonly float Degrees;\n\n    public Angle(float degrees)\n    {\n        this.Degrees = degrees;\n    }\n\n    ...\n    public static Angle FromDegrees(float value) =\u003e new Angle(value);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguorg%2Fgu.twincat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguorg%2Fgu.twincat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguorg%2Fgu.twincat/lists"}