Main Site Documentation

Usage-Problem BreadBoard_X1 on FEZ Spider


#1

Hi Guys,

I’m a new in programming on .net gadgeteers.
I’ve the FEZ Spider 1.0 Board and some Modules like the BreadBoard_X1.
I was looking for, how to use the BreadBoard Module.
I Use VisualStudio 2012 and I was reading some documentations e.g. Emulating a Button Module.
Its works fine, but I dont want to emulate a module, I want to use the Breadboard Pins.
I tried few Code examples e.g. documentations of DigitalOutput and from posts of this forum.

I want to use the Button and all 4 LED’s, maybe later more pins for external leds or something else. If I send an interrupt, here with the button, I want to activate some leds. (Its only a short description, what I want to do)

Could you help me, how I can use the individual Pins?

I tried to use the breadBoard_X1.SetupDigitalOutput(…) function and similar the AnalogInput for the button, but nothing helps it does not works.

I have no code at this time, because I tried to many things and I overwritten the old one.

Thanks in advance

regards
Dave


#2

okay,
I found my Problem, the emulator in VisualStudio had a problem and I changed the Socket, but not on the hardware…

How can I use an InterruptHandler to this button, if it pressed, first I want to turn on the 2 LEDs.

Here is my Code.

 DigitalOutput LED1 = breadBoard_X1.SetupDigitalOutput(GT.Socket.Pin.Five, false);
            DigitalOutput LED2 = breadBoard_X1.SetupDigitalOutput(GT.Socket.Pin.Six, false);
            GTI.InterruptInput button = breadBoard_X1.SetupInterruptInput(GT.Socket.Pin.Three, GTI.GlitchFilterMode.On, GTI.ResistorMode.PullUp, GTI.InterruptMode.RisingAndFallingEdge);


#3

button+=
to complete the handler definition, and to create the handler stub.
Then add the code you want in the stub. In your case it’ll involve LED1 and LED2 although you’ll need to move those object’s definitions outside the ProgramStarted() (within the public partial class Program() )


#4

Thank you guys,

it works.

Now I have this:

        DigitalOutput LED1, LED2, LED3, LED4;

        void ProgramStarted()
        {
            LED1 = breadBoard_X1.SetupDigitalOutput(GT.Socket.Pin.Four, false);
            LED2 = breadBoard_X1.SetupDigitalOutput(GT.Socket.Pin.Five, false);
            LED3 = breadBoard_X1.SetupDigitalOutput(GT.Socket.Pin.Six, false);
            LED4 = breadBoard_X1.SetupDigitalOutput(GT.Socket.Pin.Seven, false);

            GTI.InterruptInput button = breadBoard_X1.SetupInterruptInput(GT.Socket.Pin.Three, GTI.GlitchFilterMode.On, GTI.ResistorMode.PullUp, GTI.InterruptMode.RisingAndFallingEdge);
            button.Interrupt += new InterruptInput.InterruptEventHandler(button_Interrupt);
        }

        void button_Interrupt(InterruptInput sender, bool value)
        {
            LED1.Write(!LED1.Read());
        }

button+= had no effect, no autocomplete.
but with button.Interrupt+= new it completed like in the code above.

with button.Interrupt+= it completed to button.Interrupt+=button_Interrupt;
I used the other with the EventHandler.

Thanks a lot.