mirror of
https://github.com/evopro-ag/Sharp7Reactive.git
synced 2025-12-15 19:32:53 +00:00
Update LinqPad samples
This commit is contained in:
@@ -23,7 +23,7 @@ await plc.InitializeConnection();
|
|||||||
// create an IObservable
|
// create an IObservable
|
||||||
var observable = plc.CreateNotification<short>($"DB{db}.Int6", Sharp7.Rx.Enums.TransmissionMode.OnChange);
|
var observable = plc.CreateNotification<short>($"DB{db}.Int6", Sharp7.Rx.Enums.TransmissionMode.OnChange);
|
||||||
|
|
||||||
observable.Dump();
|
_ = observable.Dump();
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,10 +20,12 @@ using var plc = new Sharp7Plc(ip, rackNumber, cpuMpiAddress);
|
|||||||
// Initialize connection
|
// Initialize connection
|
||||||
await plc.InitializeConnection();
|
await plc.InitializeConnection();
|
||||||
|
|
||||||
// wait for connection to be established
|
// // Alternative: Trigger connection and wait for ConnectionState == Connected
|
||||||
await plc.ConnectionState
|
// plc.TriggerConnection();
|
||||||
.FirstAsync(c => c == Sharp7.Rx.Enums.ConnectionState.Connected)
|
// // wait for connection to be established
|
||||||
.ToTask();
|
//await plc.ConnectionState
|
||||||
|
// .FirstAsync(c => c == Sharp7.Rx.Enums.ConnectionState.Connected)
|
||||||
|
// .ToTask();
|
||||||
|
|
||||||
"Connection established".Dump();
|
"Connection established".Dump();
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ var cpuMpiAddress = 0;
|
|||||||
|
|
||||||
using var plc = new Sharp7Plc(ip, rackNumber, cpuMpiAddress);
|
using var plc = new Sharp7Plc(ip, rackNumber, cpuMpiAddress);
|
||||||
|
|
||||||
plc.ConnectionState.Dump();
|
_ = plc.ConnectionState.Dump();
|
||||||
|
|
||||||
await plc.InitializeConnection();
|
await plc.InitializeConnection();
|
||||||
|
|
||||||
// create an IObservable
|
// create an IObservable
|
||||||
plc.CreateNotification<short>($"DB{db}.Int6", Sharp7.Rx.Enums.TransmissionMode.OnChange).Dump("Int 6");
|
_ = plc.CreateNotification<short>($"DB{db}.Int6", Sharp7.Rx.Enums.TransmissionMode.OnChange).Dump("Int 6");
|
||||||
plc.CreateNotification<float>($"DB{db}.Real10", Sharp7.Rx.Enums.TransmissionMode.OnChange).Dump("Real 10");
|
_ = plc.CreateNotification<float>($"DB{db}.Real10", Sharp7.Rx.Enums.TransmissionMode.OnChange).Dump("Real 10");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user