Here is how using ^ Operator Boolean logical operators - the boolean and, or, not, and xor operators | Microsoft Learn :
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.