Main program IO project created

This commit is contained in:
atef 2026-04-10 15:17:46 +02:00
parent d97167316a
commit a137ce67f8
1 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,39 @@
using System;
using System.Threading;
using GPIORaspberryPI4;
namespace InnovEnergy.App.GpioTestingProject;
static class Program
{
static void Main(string[] args)
{
Console.WriteLine("GPIO17 Relay Test Starting...");
using IRelayOutput relay = new RelayOutput(pin: 27, activeLow: false);
using IDigitalInput input = new DigitalInput(pin: 17, pullUp: true, activeLow: true);
try
{
while (true)
{
if (input.Read())
{
relay.On();
Console.Write("\rInput ACTIVE -> Relay ON ");
}
else
{
relay.Off();
Console.Write("\rInput INACTIVE -> Relay OFF ");
}
Thread.Sleep(100);
}
}
catch (Exception ex)
{
Console.WriteLine($"ERROR: {ex.Message}");
}
}
}