Main Site Documentation

Disable LED of Wifi


#1

Is there a way to set wifi module off or led off on FEZ board ?


#2

Do you mean disable the LEDs that are connected to the wifi module? I think you can disable only the “blinking” LED. It has been a while since I looked at the datasheet.

The best place to see what the module is capable of is through the module’s datasheet.


#3

Thanks for tips. I’ll dive into datasheet, but I was hoping it can be done with a pin or two :slight_smile:


#4

But you like challenges :slight_smile:


#5

When not using Wifi, I can do:

var cont = GpioController.GetDefault();
ResetWifi = cont.OpenPin(Pins.FEZ.GpioPin.WiFiReset);
ResetWifi.SetDriveMode(GpioPinDriveMode.Output);
ResetWifi.Write(GpioPinValue.Low);

#6

I knew you will find a way :wink:


#7

With use of wifi, it can be done by:

        public void DisableLed()
        {
            if (!running) throw new Exception("Must be called after TurnOn() function");
            SetBlinkLed(false);
            SetGpioOutput(13, Direction.Output);
            SetGpioOutput(14, Direction.Output);
        }

        protected enum Direction { Input, Output }
        protected void SetBlinkLed(bool active)
        {
            var cmd = this.GetCommand()
                .AddParameter("blink_led")
                .AddParameter(active ? "1" : "0")
                .Finalize(SPWF04SxCommandIds.SCFG);
            this.EnqueueCommand(cmd);
            cmd.ReadBuffer();
            this.FinishCommand(cmd);
        }

        protected void SetGpioOutput(int number, Direction dir, bool active = false)
        {
            {

                var cmd = this.GetCommand()
                    .AddParameter(number.ToString())
                    .AddParameter(dir == Direction.Output ? "out" : "in")
                    .Finalize(SPWF04SxCommandIds.GPIOC);
                this.EnqueueCommand(cmd);
                cmd.ReadBuffer();
                this.FinishCommand(cmd);
            }
            {
                var cmd = this.GetCommand()
                    .AddParameter(number.ToString())
                    .AddParameter(active ? "1" : "0")
                    .Finalize(SPWF04SxCommandIds.GPIOW);
                this.EnqueueCommand(cmd);
                cmd.ReadBuffer();
                this.FinishCommand(cmd);
            }
        }