Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relay fix #9

Merged
merged 2 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void SetAllOn()
{
foreach (var relay in Relays)
{
relay.IsOn = true;
relay.State = RelayState.Closed;
}
}

Expand All @@ -76,7 +76,7 @@ public void SetAllOff()
{
foreach (var relay in Relays)
{
relay.IsOn = false;
relay.State = RelayState.Open;
}
}

Expand Down
12 changes: 6 additions & 6 deletions Source/Relays.ElectromagneticRelayModule/Driver/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@ public override Task Run()
{
for (int i = 0; i < 5; i++)
{
Console.Write("All on");
Console.Write("All on (closed)");
module.SetAllOn();

Thread.Sleep(1000);

Console.Write("All off");
Console.Write("All off (open)");
module.SetAllOff();

Thread.Sleep(1000);

for (int j = 0; j < (int)RelayIndex.Relay4; j++)
{
Console.Write($"{(RelayIndex)j} on");
module.Relays[j].IsOn = true;
Console.Write($"{(RelayIndex)j} on (closed)");
module.Relays[j].State = RelayState.Closed;
Thread.Sleep(1000);
}

for (int j = 0; j < (int)RelayIndex.Relay4; j++)
{
Console.Write($"{(RelayIndex)j} off");
module.Relays[j].IsOn = false;
Console.Write($"{(RelayIndex)j} off (open)");
module.Relays[j].State = RelayState.Open;
Thread.Sleep(1000);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Meadow;
using Meadow.Devices;
using Meadow.Foundation.Relays;
using Meadow.Peripherals.Relays;
using System;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -27,27 +28,27 @@ public override Task Run()
{
for (int i = 0; i < 5; i++)
{
Console.Write("All on");
Console.Write("All on (closed)");
module.SetAllOn();

Thread.Sleep(1000);

Console.Write("All off");
Console.Write("All off (open)");
module.SetAllOff();

Thread.Sleep(1000);

for (int j = 0; j < (int)RelayIndex.Relay4; j++)
{
Console.Write($"{(RelayIndex)j} on");
module.Relays[j].IsOn = true;
Console.Write($"{(RelayIndex)j} on (closed)");
module.Relays[j].State = RelayState.Closed;
Thread.Sleep(1000);
}

for (int j = 0; j < (int)RelayIndex.Relay4; j++)
{
Console.Write($"{(RelayIndex)j} off");
module.Relays[j].IsOn = false;
Console.Write($"{(RelayIndex)j} off (open)");
module.Relays[j].State = RelayState.Open;
Thread.Sleep(1000);
}
}
Expand Down
Loading