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]; }
void motion_Sensor_Motion_Sensed(GTM.Motion_Sensor sender, GTM.Motion_Sensor.Motion_SensorState state) { if (!Scheduler.Instance().canContinue()) return; if (sendingPicture) return; if (timer.IsRunning) return; timer.Start(); sendingPicture = true; Scheduler.Instance().Working = true; Debug.Print("nuevo motion sensor"); camera.TakePicture(); }
void button_ButtonPressed(GTM.Button sender, GTM.Button.ButtonState state) { Debug.Print("boton apretado program"); if (Scheduler.Instance().getActivation()) { Scheduler.Instance().setActivation(false); sender.LEDMode = Button.LEDModes.Off; } else { sender.LEDMode = Button.LEDModes.On; Thread.Sleep(waitTime); Scheduler.Instance().setActivation(true); } }
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); }
void button_ButtonPressed(GTM.Button sender, GTM.Button.ButtonState state) { blueT.HostMode.InquireDevice(); Debug.Print("boton"); }