Code for Eth Mainboard

I’m working on writing code for a Mountaineer Eth Mainboard. I am programming 3 RGB LED’s and a switch, as well as socket communications. Im having problems with the usings:

using System.Linq;
using System.Text.RegularExpressions;
using System.Net.NetworkInformation;

the bold parts above are giving me errors that they do no exist but i’ve used them in several other applications. Are they not working because im using the Gadgeteer framework?

Also, to change the color of the LED’s im using the GPIO pins which are enumerated as such:

public class Socket1 
{
    public const Cpu.Pin BluePinA = (Cpu.Pin)59; //blue LED pin
    public const Cpu.Pin GreenPinA = (Cpu.Pin)49; //green LED pin
    public const Cpu.Pin RedPinA = (Cpu.Pin)48; //red LED pin
}

Since they’re interpreted as constants how do i “turn on/off” the Pins to change the color. I’m still pretty new to C# so im sure that im missing something.

@ UofLTCI - The micro framework is a very cut down version of it’s big brother so you cant use alot of the full framework namespaces hence why your using’s are causing a problem.

Have a look here GHI Electronics – Where Hardware Meets Software for turning pins on and off.

1 Like

This should blink a LED wired to pin 3 of socket 1



using Gadgeteer.Interfaces;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

namespace GadgeteerApp1
{
    public partial class Program
    {
        private GT.Interfaces.DigitalOutput led;
        private GT.Timer timer;

        private void ProgramStarted()
        {
            timer = new GT.Timer(500);
            timer.Tick += new GT.Timer.TickEventHandler(TimerTick);
            led = new DigitalOutput(GT.Socket.GetSocket(1, true, null, null), GT.Socket.Pin.Three, false, null);
            timer.Start();
        }

        void TimerTick(GT.Timer timer)
        {
            led.Write(!led.Read());
        }
    }
}


To add to what Justin said, those namespaces are in the full .NET framwork, but not in the micro framework. That’s one reason they call it micro :slight_smile: I would suggest doing some homework on what is in NETMF, and starting with some sample code first.

1 Like