Hi,
my FEZ Spider doesn’t raise events, sometimes he does but then only very delayed when I press the button very often. I’ve already replaced the button and the cable with an other one, but this didn’t change anything. What am I doing wrong? I’ve already updated the firmware:
TinyBooter Version: 4.1.6.0
Firmware Version: 4.1.7.0
Thanks
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
namespace GadgeteerApp1
{
public partial class Program
{
void ProgramStarted()
{
/******************************************************************************************
Access modules defined in the designer by typing their name:
e.g. button
camera1
Initialize event handlers here.
e.g. button.ButtonPressed += new GTM.MSR.Button.ButtonEventHandler(button_ButtonPressed);
***************************************************************************************** */
/**/
button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
// Do one-time tasks here
Debug.Print("Program Started");
}
void button_ButtonPressed(Button sender, Button.ButtonState state)
{
try
{
Debug.Print("ButtonPressed");
button.ToggleLED();
}
catch (Exception e)
{
Debug.Print(e.ToString());
}
}
}
}
This didn’t work for me
Maybe I need some kind of Button-Patch, but I can’t find a working download-link. Or do I need another SDK-Version? I have v4.1 from this site [url]http://tinyclr.com/forum/12/5117/[/url]… Pls help :o
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
namespace GadgeteerApp1
{
public partial class Program
{
void ProgramStarted()
{
/******************************************************************************************
Access modules defined in the designer by typing their name:
e.g. button
camera1
Initialize event handlers here.
e.g. button.ButtonPressed += new GTM.MSR.Button.ButtonEventHandler(button_ButtonPressed);
***************************************************************************************** */
/**/
button.ButtonReleased += new Button.ButtonEventHandler(button_ButtonReleased);
button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
// Do one-time tasks here
Debug.Print("Program Started");
}
void button_ButtonReleased(Button sender, Button.ButtonState state)
{
}
void button_ButtonPressed(Button sender, Button.ButtonState state)
{
try
{
Debug.Print("Pressed");
button.ToggleLED();
}
catch (Exception e)
{
Debug.Print(e.ToString());
}
}
}
}
This fixes the button pressed/released issue, but has another bug where you must register an event for both pressed and released or you’ll get a different error, but otherwise it look fine if you’re just getting started, the camera demo works fine so should tide me over for a few days until the next full release version of the SDK is released.
@ GHI Guy’s two bugs in a button class so you can’t even get through the ‘Getting Started’ guide, quite impressive :o
You are using beta software. You may want to wait till non-beta SDK is out please. Another option is to get the button driver sources from codeplex and fix the code. We welcome contributions on open source code, that we are giving and maintaining for free
@ bromod if you don’t want to install the beta SDK, copy the code from [url]http://codepaste.net/rzixqp[/url] and put it in a file in your project and it will be used instead of the one in the SDK, it fixes both the issues above.