Skip to content

Commit

Permalink
Merge pull request #9 from WildernessLabs/relay_fix
Browse files Browse the repository at this point in the history
Relay fix
  • Loading branch information
ctacke authored Dec 27, 2023
2 parents c9b3208 + 029e84e commit f179741
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
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

0 comments on commit f179741

Please sign in to comment.