Main Site Documentation

Getting started guides


#1

hi,

getting used to coding and all that can be achieved with gadgeteer, wondered if you can point me to some good step by step guides?
I have been working through the ‘camera’ that seems to be a start point for most people but want to learn coding before I spend lots on components. can anyone help?


#2

There are 4 free books and plenty of tutorials. Look for “Downloads and Tutorials” link on top of this page.

Welcome to the community.


#3

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

namespace workyougit
{
public partial class Program
{
// This method is run when the mainboard is powered up or reset.
Gadgeteer.Modules.GHIElectronics.LED7R led7r;
Gadgeteer.Modules.GHIElectronics.Button button;

    void ProgramStarted()
    {
        button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
        //LED7R = Button.LEDModes.OnWhilePressed;
        led7r.TurnLightOn(14, false);

    }
    void button_ButtonPressed(Button sender, Button.ButtonState state)
    {
        Debug.Print("Button has been Pressed");
    }
}

}



up loaded this code and it runs but does not function. ie LED does not turn on, yes I am an absolute beginner, please help…


#4

Have you read all the ebooks and getting started documents?


#5

@ rob_dphillips

Your button press handler doesn’t do anything. You never turn on the led anywhere in the code.

And please use code tags when you post any code - easier to read.


#6

architect,

thank you, can you show me how?

I thought this would switch the LED on?

button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
//LED7R = Button.LEDModes.OnWhilePressed;
led7r.TurnLightOn(14, false);


#7
  1. Go to you post with code and click “Modify”
  2. Select all text that has code in the editor
  3. Click the button in the toolbar that has zeros and ones.
  4. Submit your post

#8

You have 7 leds only on that module. For the first parameter you can use values in the range 0-6.
Try:

led7r.TurnLightOn(0) //second parameter is false by default

#9

thanks architect,

can you show me where that would be in the whole code?


#10

sorry to be a pain, but I am very new to C# and if I can see the whole thing together then I can see where I have been going wrong and learn from it…

please help community :slight_smile:


#11

Connect 7 led module and button using visual designer.

Try something like this:


public partial class Program
    {
        void ProgramStarted()
        {
            button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);             
        }

        int led = 0
        void button_ButtonPressed(Button sender, Button.ButtonState state)
        {
            led = (led+1)%7;
            led7r.TurnLightOn(led,true);
        }
    }


#12

Architect what does this mean

An unhandled exception of type ‘System.Exception’ occurred in Microsoft.SPOT.Hardware.dll

when I am trying to up load? is this a firmware issue?

let me know thanks.


#13
namespace GadgeteerApp1
{
    public partial class Program
    {
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            
                Debug.Print("button pressed");
                led.TurnBlue();
                Debug.Print("Program Started");
            
        }
    }
}

I am only trying to do some really simple stuff but this keeps coming up.
System.Exception’ occurred in Microsoft.SPOT.Hardware.dll

I am using a 17inch macbook pro running windows 7 all kits updated… very strange, can you help?


#14

Rob, sounds like firmware version to me. Check your version, show us the output of the MFDeploy Device Capabilities, and coinfirm what SDK version you have installed (the README in the GHI directory)


#15

thanks Brett just going through it now. just taken for ever, much appreciated


#16

yes brett it was me!!!

so so so so so happy. now its working time to do the fun stuff :slight_smile: :slight_smile: :slight_smile: :slight_smile: