Esempio n. 1
0
 public Sim900Modem(int port, GTM.Display_HD44780 display)
 {
     this.display = display;
     socket = GT.Socket.GetSocket(port, true, null, null);
     powerPin = new GTI.DigitalOutput(socket, GT.Socket.Pin.Three, false, null);
     serial = new System.IO.Ports.SerialPort("COM2", 115200, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);
     serial.ReadTimeout = 1000;
     serial.Open();
     bufferd = new byte[32];
 }
Esempio n. 2
0
        public static void Init(GTM.Display_HD44780 display)
        {
            version = "v 1.0";
            sensorVoltage = 4.80D;
            mvpermm = sensorVoltage / 512D;
            Service.display = display;

            if (extender == null)
            {
                extender = new GTM.Extender(3);
            }

            if (sensors == null)
            {
                sensors = new AnalogInput[3];
            }

            if (sensors[0] == null)
                sensors[0] = extender.SetupAnalogInput(GT.Socket.Pin.Three);
            if (sensors[1] == null)
                sensors[1] = extender.SetupAnalogInput(GT.Socket.Pin.Four);
            if (sensors[2] == null)
                sensors[2] = extender.SetupAnalogInput(GT.Socket.Pin.Five);

            sensorMedians = new ArrayList();
            maxSensorIterations = 4; // must be div by 2

            if (sensorTimer == null)
            {
                sensorTimer = new GT.Timer(500);
                sensorTimer.Tick += new GT.Timer.TickEventHandler(sensorTimer_Tick);
            }

            if (firstTimeTimer == null)
            {
                firstTimeTimer = new GT.Timer(500);
                firstTimeTimer.Tick += new GT.Timer.TickEventHandler(firstTimeTimer_Tick);
            }

            if (modem == null)
            {
                modem = new Sim900Modem(2, display);
            }

            Utilities.DisplayOnLine1(String.Concat("ozlo, llc ", version), display);
        }