Tech Talk with Gus 05 - Gadgeteer

It’s time for another episode of Tech Talk with Gus. In this episode we’ll be talking about Gadgeteer components and how to use them in the future, with other products and boards.

3 Likes
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHI.Pins;

namespace native_gadgeteer
{
    public class Program
    {
        public static void Main()
        {
            //OutputPort LED = new OutputPort(G120E.Gpio.P2_12, true);
            OutputPort[] Bar = new OutputPort[7];
            Bar[0] = new OutputPort(G120E.Gpio.P2_13, false);
            Bar[1] = new OutputPort(G120E.Gpio.P1_26, false);
            Bar[2] = new OutputPort(G120E.Gpio.P1_27, false);
            Bar[3] = new OutputPort(G120E.Gpio.P1_28, false);
            Bar[4] = new OutputPort(G120E.Gpio.P1_29, false);
            Bar[5] = new OutputPort(G120E.Gpio.P2_4, false);
            Bar[6] = new OutputPort(G120E.Gpio.P2_2, false);

            OutputPort LED = new OutputPort(G120E.Gpio.P2_12, true);
            AnalogInput Ain = new AnalogInput(G120E.AnalogInput.P0_12);

            bool state = true;
            while (true)
            {
                for(int i=0;i<7;i++)
                {
                    Bar[i].Write(false);
                }
                int level = (int)(Ain.Read() * 7);
                for(int i=0;i<level;i++)
                {
                    Bar[i].Write(true);
                }
                //Debug.Print("Ain " + Ain.Read());
                state = !state;
                LED.Write(state);
                Thread.Sleep(100);
            }
        }
    }
}
2 Likes