using System;
using System.IO;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.IO;

namespace CPF
{

    public class Program
    {
     
        public static void Main()
        {

            byte[] buffer = new byte[16];


            int l = NumberConversions.IntegerToByteArray(ref buffer, 0, 123456789);
            string s = "";
            foreach (byte b in buffer)
            {
                s = s + (((char)b).ToString());
            }
            Debug.Print(s + "length = " + l.ToString());

            int m = NumberConversions.IntegerToByteArray(ref buffer, 0, -987654321);
            s = "";
            foreach (byte b in buffer)
            {
                s = s + (((char)b).ToString());
            }
            Debug.Print(s + "length = " + m.ToString());

            Pump elmo = new Pump();
            PositionSensor whereAmI = new PositionSensor();
            double position = -1.0;

            position = whereAmI.Position;
            elmo.Speed(100.0);
            position = whereAmI.Position;
            elmo.Speed(1000.0);
            position = whereAmI.Position;
            elmo.Stop();
            position = whereAmI.Position;
            elmo.Speed(-100);
            position = whereAmI.Position;
            elmo.Speed(-1234);
            position = whereAmI.Position;

            //aProfiler.Start();

            //Media _sdCard = new Media();
            //_sdCard.Start();

            /*
            Controller aController = new Controller(new CPF_HSM());
            aController.Add((Signal) ProfilerEvents.Baking);
            aController.Add((Signal) ProfilerEvents.OpenDoor);
            aController.Add((Signal) ProfilerEvents.CloseDoor);
            aController.Start();
             */
            for (; ; )
            {
                Thread.Sleep(100);
            }
        }
    }
}
