How to effectively an Blink an LED?

Here is how using ^ Operator Boolean logical operators - the boolean and, or, not, and xor operators | Microsoft Learn ::slight_smile:



         private static bool state;
        //the below depends on the type of your board, please check it's schematics
        private static readonly OutputPort LedRed = new OutputPort((Cpu.Pin)77, false);

        public static void Main()
        {
          new Thread(Blink).Start();
        }

        public static void Blink()
        {
            while (true)
            {
                state ^= true;
                LedRed.Write(state);
                Thread.Sleep(500);
            }
        }

Cheers,
Jay.

now before Bill jumps in and diss me I will share Justin’s suggestion as well :slight_smile:


         //the below depends on the type of your board, please check it's schematics
         private static readonly OutputPort LedRed = new OutputPort((Cpu.Pin)77, false);

         public static void Main()
         {
           new Thread(Blink).Start();
         }

         public static void Blink()
         {
             while (true)
             {             
                 LedRed.Write(!LedRed.Read());
                 Thread.Sleep(500);
             }
         }

You happy now Justin :slight_smile:

Delirious :clap: