everyone. I am trying to control relais 5v with nanoframework on esp32. The problem that I get is that the relay is still in action when I connect pin 21 with the In pin of the relay, even though the esp32 pin is in PinValue.Low. My thanks and appreciation to everyone who try to help. Hers is my code:
using System;
using System.Diagnostics;
using System.Threading;
using System.Device.Gpio;
using nanoFramework.Hardware.Esp32;
namespace NFApp3
{
public class Program
{
//private static GpioController s_GpioController;
public static void Main()
{
GpioController s_GpioController =new GpioController();
GpioPin led = s_GpioController.OpenPin(21,PinMode.Output);
led.Write(0);
//led.Write(PinValue.High);
Thread.Sleep(Timeout.Infinite);
}
}
}
You should be using
led.Write(PinValue.Low);
instead of writing 0.