I am truing run a project from here - http://blogs.msdn.com/b/net_gadgeteer/archive/2011/12/19/why-not-while-true.aspx#comments using the button on the FEZ Cerberus board. I get the error that "The name ‘button’ does not exist in the current context ". Below is the code with the namespaces and attached the references. BTW - this is a problem I have all the time where I am not sure which namespaces and references should be included. Any idea?
using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Touch;
using Microsoft.SPOT.Net;
using Microsoft.SPOT.Hardware;
using System.IO.Ports;
using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
namespace ButtonANDLight
{
public partial class Program
{
GT.Timer ledBlinkTimer = new GT.Timer(1000);
void ProgramStarted()
{
button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
ledBlinkTimer.Tick += new GT.Timer.TickEventHandler(ledBlinkTimer_Tick);
ledBlinkTimer.Start();
}
void ledBlinkTimer_Tick(GT.Timer timer)
{
if (button.IsLedOn == true)
{
button.TurnLEDOff();
}
else
button.TurnLEDOn();
}
void button_ButtonPressed(Button sender, Button.ButtonState state)
{
Debug.Print("Button Pressed");
}
}
}