Main Site Documentation

FEZ Spider quandry - Debug with simple button


#1

Hello!
I’m a newbie and have been struggling with getting a simple example to run.
I was trying to run the example from GHI using display, camera and button but
couldn’t get any results so I stripped out the camera and display and now am just
trying to get a simple button to toggle led on/off.

I did add a 9v 800ma power supply in addition to the usb so running in dual power.

You can see my simple code in the image - basically, in the ProgramStarted function, I
only set up the buttonPressed event and do a debug print:

button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
Debug.Print(“Hello”);

Here are the strange things I see:

  1. I never see “Hello” printed on the output as I would expect.
  2. I always see “Program Started” (I’ve cleaned and rebuilt the project, don’t know where this message comes from)
  3. When I run (F5), the button_ButtonPressed function always gets called once (I have a break point) , even though I did not press the button. After the breakpoint, I continue so the program is running.
  4. after I see program started, I press the button several (many) times but the function ButtonPressed is never called (ie never get breakpoint, and if I remove breakpoint, never see led toggle on the button module anyway).

And, even though the ButtonPressed function is called once during the program start (for some unknown reason), still don’t see led toggle and do not see debug output message
"button".
So, it seems like the software just doesn’t run correctly. I’m hoping to get another power supply (12v, 1a), but with just a button module connected, I doubt this is the problem as the power led is pretty bright.
Please look at the attached image and I’m hoping someone has some ideas…
Thanks very much!!


#2

Thanks Andre,

I attached the screen shot…


#3

Ok, I built a new project from scratch and now the button function gets called when I press the button.

The led seemed to briefly toggle on once but maybe that part is a power issue.

At least now, the code runs as expected (I see “Hello” and whenever I press the button, I see “button”).

Thanks Andre - your input made sense - somehow, I think my original project was
trashed or something and wasn’t getting built correctly…

Now, I’ll try to get the camera and display to work.
So, you can close this particular question - everything looks good (except led doesn’t toggle, but maybe that is power…)