Hi Guys!
Can some one help me with the following test application. The LED are flashing on the button, the Debug button is ON, I just do not get the event. I have tried Port 4 & 8 along with both buttons that came with my Spider.
Any help, much appreciated!!!
Regards
MarkB
Version
VS2012 Enterprise
Spider Firmware 4.2.10.1
Assembly: mscorlib (4.2.0.0)
Assembly: Microsoft.SPOT.Native (4.2.0.0)
Assembly: Microsoft.SPOT.Security.PKCS11 (4.2.0.0)
Assembly: System.Security (4.2.0.0) Loading Deployment Assemblies.
Attaching deployed file.
Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1) Attaching deployed file.
Assembly: Gadgeteer (2.42.0.0) Attaching deployed file.
Assembly: Microsoft.SPOT.Graphics (4.2.0.0) Attaching deployed file.
Assembly: Microsoft.SPOT.Hardware (4.2.0.0) Attaching deployed file.
Assembly: Microsoft.SPOT.IO (4.2.0.0) Attaching deployed file.
Assembly: GTM.GHIElectronics.Button (1.1.2.0) Attaching deployed file.
Assembly: Microsoft.SPOT.TinyCore (4.2.0.0) Attaching deployed file.
Assembly: System.IO (4.2.0.0) Attaching deployed file.
Assembly: GHI.Premium.System (4.2.10.0) Attaching deployed file.
Assembly: Test (1.0.0.0) Attaching deployed file.
Assembly: GHI.Premium.IO (4.2.10.0) Attaching deployed file.
Assembly: Microsoft.SPOT.Net (4.2.0.0) Attaching deployed file.
Assembly: GHI.Premium.Hardware (4.2.10.0) Attaching deployed file.
Assembly: GHIElectronics.Gadgeteer.FEZSpider (1.1.2.0) Resolving.
namespace Test {
using Gadgeteer;
using GTM = Gadgeteer.Modules;
public partial class Program : Gadgeteer.Program {
private Gadgeteer.Modules.GHIElectronics.Button button;
public static void Main() {
// Important to initialize the Mainboard first
Program.Mainboard = new GHIElectronics.Gadgeteer.FEZSpider();
Program p = new Program();
p.InitializeModules();
p.ProgramStarted();
// Starts Dispatcher
p.Run();
}
private void InitializeModules() {
this.button = new GTM.GHIElectronics.Button(4);
}
}
}
using System.Threading;
using Microsoft.SPOT;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
namespace Test
{
public partial class Program
{
void ProgramStarted()
{
button.ButtonPressed += button_ButtonPressed;
var startUpTimer = new GT.Timer(200, GT.Timer.BehaviorType.RunOnce);
startUpTimer.Tick += OnStartUpTimer;
startUpTimer.Start();
}
private void OnStartUpTimer(GT.Timer timer)
{
Mainboard.SetDebugLED(true);
while (true)
{
button.LEDMode = button.LEDMode == Gadgeteer.Modules.GHIElectronics.Button.LEDModes.On
? Gadgeteer.Modules.GHIElectronics.Button.LEDModes.Off
: Gadgeteer.Modules.GHIElectronics.Button.LEDModes.On;
Thread.Sleep(1000);
}
}
private static void button_ButtonPressed(GTM.GHIElectronics.Button sender, GTM.GHIElectronics.Button.ButtonState state)
{
Debug.Print("ButtonPressed State: " + state);
Mainboard.SetDebugLED(false);
Thread.Sleep(500);
Mainboard.SetDebugLED(true);
}
}
}