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