// This method is run when the mainboard is powered up or reset. void ProgramStarted() { _bluetooth = new Bluetooth(4); _bluetooth.DebugPrintEnabled = true; _client = _bluetooth.ClientMode; _bluetooth.SetDeviceName("Gadgeteer"); _bluetooth.SetPinCode("1234"); _bluetooth.DataReceived += bluetooth_DataReceived; button.ButtonPressed += (sender, state) => _client.EnterPairingMode(); var monitor = new GT.Timer(500); monitor.Tick += timer => { if (_bluetooth.IsConnected) { //_client.Send("xxx"); } }; monitor.Start(); // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging. Debug.Print("Program Started"); var sensePuss = new GT.Timer(1000); sensePuss.Tick += timer => { relays.Relay3 = moistureSensor.GetMoistureReading() > 500; Debug.Print(moistureSensor.GetMoistureReading().ToString()); }; sensePuss.Start(); }
private void ChooseRJ(object sender) { try { lock (myLock) { connection = false; gasSense.HeatingElementEnabled = true; SetupEthernet(); ethernetJ11D.NetworkUp += OnNetworkUp; ethernetJ11D.NetworkDown += OnNetworkDown; DrawMainWindow();//to avoid delay due to timer ListNetworkInterfaces(); timerMain.Tick += DrawMainWindow; timerMain.Start(); return; } } catch (System.ApplicationException) { DrawConnetorsAlarmWindow(); return; } catch (System.Exception) { DrawConnetorsAlarmWindow(); return; } }
private void _SleepBar_Interrupt(Interfaces.InterruptInput input, bool value) { lock (_lock) { if (_glitchdt == null) { _glitchdt = new Gadgeteer.Timer(_glitchTime); _glitchdt.Tick += new Gadgeteer.Timer.TickEventHandler(_glitchdt_Tick); } bool sleeping = isAsleep; if (!_glitchdt.IsRunning || _isAsleepLastSent == true && !sleeping) { _isAsleepLastSent = sleeping; OnPowerStateChangedEvent(this, _isAsleepLastSent); } else { // filter out all but first "awake" event while glitch filter is running } if (_glitchdt.IsRunning) { // reset the timer interval _glitchdt.Start(); } } }
void IdleTimeView_TouchDown(object sender, TouchEventArgs e) { window.Background = new SolidColorBrush(GT.Color.White); currentTime = timeMgr.UpdatedTime; window.Child = ViewManager.MainView; tmrIdleTimer.Start(); }
void OnNetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state) { Debug.Print("Network up."); connected = true; server_available = true; DrawMainWindow(); timerSend.Tick += sendData; timerSend.Start(); //sendData(); return; }
void ProgramStarted() { Debug.Print("Program Started"); setupUI(); touchScreen.TouchDown += new Microsoft.SPOT.Input.TouchEventHandler(touchScreen_TouchDown); //timer to reset display timer.Tick += new GT.Timer.TickEventHandler(timer_Tick); timer.Start(); }
private void ProgramStarted() { tempHumidity.MeasurementInterval = 5000; wifiTimer.Tick += (timer) => { timer.Stop(); try { wifi_RS21.NetworkInterface.Open(); wifi_RS21.NetworkInterface.EnableDhcp(); wifi_RS21.NetworkInterface.EnableDynamicDns(); wifi_RS21.NetworkInterface.Join(Ssid, Ssid_Password); while (wifi_RS21.NetworkInterface.IPAddress == "0.0.0.0") { Debug.Print("Waiting for DHCP..."); Thread.Sleep(1000); } Debug.Print("Network ready to use."); Debug.Print("Conecting to MQTT broker ..."); mqttClient.Connect(Guid.NewGuid().ToString()); Debug.Print("Conected to MQTT broker!"); tempHumidity.StartTakingMeasurements(); Debug.Print("Sending measurements"); } catch (Exception ex) { wifiTimer.Start(); } }; NetworkChange.NetworkAvailabilityChanged += (sender, e) => { Debug.Print("Network availability: " + e.IsAvailable.ToString()); }; tempHumidity.MeasurementComplete += (sender, e) => { var temperature = "{\"value\":\"" + ((int)e.Temperature) + "\",\"tag\":\"temperature\"}"; var humidity = "{\"value\":\"" + ((int)e.RelativeHumidity) + "\",\"tag\":\"humidity\"}"; var builder = new StringBuilder("{\"sensors\":[@temperature,@humidity] }"); builder.Replace("@temperature", temperature); builder.Replace("@humidity", humidity); publishMessage(builder.ToString()); }; wifiTimer.Start(); }
public WifiWidget(WiFi_RS21 wifi_RS21) : base() { this.font = Resources.GetFont(Resources.FontResources.small); this.x = x; this.y = y; background.set_position(0, 28); background.set_size(UserInterface.Instance.screen_width, UserInterface.Instance.screen_height - 28); background.set_colours(BackgroundColor, BorderColor); elements.Clear(); elements.Add(background); // NetworkInterfaceExtension.AssignNetworkingStackTo((NetworkInterfaceExtension)wifi_RS21); this.wifi_RS21 = wifi_RS21; this.wifi_RS21.UseThisNetworkInterface(); this.wifi_RS21.Interface.NetworkInterface.EnableDhcp(); this.wifi_RS21.UseDHCP(); this.wifi_RS21.NetworkDown += new GT.Modules.Module.NetworkModule.NetworkEventHandler(wifi_NetworkDown); this.wifi_RS21.NetworkUp += new GT.Modules.Module.NetworkModule.NetworkEventHandler(wifi_NetworkUp); // connect to known wifi GT.Timer t = new GT.Timer(1000); t.Tick += new GT.Timer.TickEventHandler(t_Tick); t.Start(); }
private void NetworkChange_NetworkAddressChanged(object sender, EventArgs e) { /* * Debug.Print("Network Address Change to: " + wifiRS21.NetworkInterface.IPAddress); * if (wifiRS21.NetworkInterface.IPAddress != "0.0.0.0") * { * Debug.Print("Gateway Address: " + wifiRS21.NetworkInterface.GatewayAddress); * foreach (var dns in wifiRS21.NetworkInterface.DnsAddresses) * { * Debug.Print("DNS Address: " + dns); * } * */ Debug.Print("Network Address Change to: " + ethernetJ11D.NetworkInterface.IPAddress); if (ethernetJ11D.NetworkInterface.IPAddress != "0.0.0.0") { Debug.Print("IP Address: " + ethernetJ11D.NetworkInterface.IPAddress); Debug.Print("Gateway Address: " + ethernetJ11D.NetworkInterface.GatewayAddress); foreach (string dns in ethernetJ11D.NetworkInterface.DnsAddresses) { Debug.Print("DNS Address: " + dns); } // get Internet Time using SNTP GetInternetTime(); // Initialize AMQP _connection with Azure Event Hub InitAMQPconnection(); _timer.Start(); } }
void ProgramStarted() { Debug.Print("Program Started"); //setup static ip biar cepet ethernetENC28.NetworkInterface.Open(); ethernetENC28.NetworkSettings.EnableStaticIP("192.168.1.123", "255.255.255.0", "192.168.1.1"); ethernetENC28.NetworkSettings.EnableStaticDns(new string[] { "192.168.1.1" }); //bermanfaat kalau pake dhcp while (ethernetENC28.NetworkInterface.IPAddress == "0.0.0.0") { Debug.Print("Waiting for connect"); Thread.Sleep(250); } Thread.Sleep(5000); //konek ke mqtt broker client = new MqttClient(IPAddress.Parse(MQTT_BROKER_ADDRESS)); string clientId = Guid.NewGuid().ToString(); client.Connect(clientId, "guest", "guest"); //subcribe topik SubscribeMessage(); //setup timer untuk ambil data sensor ruangan GT.Timer timer = new GT.Timer(2000); timer.Tick += timer_Tick; timer.Start(); }
void ProgramStarted() { this.last = new Point(0, 0); this.touched = false; this.displayCP7.ScreenPressed += this.OnScreenPressed; this.displayCP7.ScreenReleased += this.OnScreenReleased; this.displayCP7.GestureDetected += this.OnGesureDetected; Glide.FitToScreen = true; Debug.Print("Program Started"); mainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.mainWindow)); Image image = (Image)mainWindow.GetChildByName("earthImage"); image.Bitmap = new Bitmap(Resources.GetBytes(Resources.BinaryResources.main),Bitmap.BitmapImageType.Jpeg); mainWindow.BackColor = Microsoft.SPOT.Presentation.Media.Color.White; Glide.MainWindow = mainWindow; DateTime dateTime = new DateTime(2015, 12, 18, 20, 53, 0); Utility.SetLocalTime(dateTime); RealTimeClock.SetDateTime(dateTime); GHI.Glide.UI.Button myText = (GHI.Glide.UI.Button)mainWindow.GetChildByName("keyboard"); myText.PressEvent += new OnPress(Glide.OpenKeyboard); Gadgeteer.Timer timer = new Gadgeteer.Timer(500); timer.Tick += TimerTick; timer.Start(); }
public void EnableFaultScanner(int interval) { FaultScanner = new GT.Timer(interval); FaultScanner.Tick += FaultScanner_Tick; FaultScanner.Behavior = GT.Timer.BehaviorType.RunContinuously; FaultScanner.Start(); }
void ProgramStarted() { /******************************************************************************************* * Modules added in the Program.gadgeteer designer view are used by typing * their name followed by a period, e.g. button. or camera. * * Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.: * button.ButtonPressed +=<tab><tab> * * If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.: * GT.Timer timer = new GT.Timer(1000); // every second (1000ms) * timer.Tick +=<tab><tab> * timer.Start(); *******************************************************************************************/ // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging. // Debug.Print("Program Started"); SetupUI(); Canvas.SetLeft(tongue, tongueLeftPosition); Canvas.SetTop(tongue, 200); Canvas.SetLeft(snowflake, snowflakeLeftPosition); Canvas.SetTop(snowflake, snowflakeTopPosition); joystick.Calibrate(); joystickTimer.Tick += new GT.Timer.TickEventHandler(joystickTimer_Tick); joystickTimer.Start(); snowFlakeTimer.Tick += new GT.Timer.TickEventHandler(snowFlakeTimer_Tick); snowFlakeTimer.Start(); //joystick.JoystickReleased += new Joystick.JoystickEventHandler(joystick_JoystickReleased); joystick.JoystickReleased += new Joystick.JoystickEventHandler(joystick_JoystickReleased); }
public Wifi(Gadgeteer.Modules.GHIElectronics.WiFi_RS21 wifi_RS21) { this.wifi_RS21 = wifi_RS21; t = new GT.Timer(3000); t.Tick += new GT.Timer.TickEventHandler(start); t.Start(); }
public SensorsHandler(USBHost usbHostObject, Button buttonObject) { // Set objects usbHost = usbHostObject; button = buttonObject; // Initialize variables oldX = oldY = ""; oldTempC = oldPressureMb = oldPressureMb = 0; lastWrittenX = lastWrittenY = 0; wasMouseFailed = wasSensorFailed = true; bme280Working = false; isMouseConnected = false; // Setup USBHost patched module and get mouse if already connected InitMouse(); // Setup bosch bme280 sensor Thread setupSensor = new Thread(InitSensor); setupSensor.Start(); // Mouse timers GT.Timer mouseTimer = new GT.Timer(500); mouseTimer.Tick += mouseTimer_Tick; mouseTimer.Start(); // Mouse persistence timer GT.Timer persistenceTimer = new GT.Timer(6000); persistenceTimer.Tick += persistenceTimer_Tick; persistenceTimer.Start(); }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { display_HD44780 = new GTM.GHIElectronics.Display_HD44780(1); CheckForServiceUpdate(); Display("Loading assembly", ""); JayDayService.Service.Init(display_HD44780); JayDayService.Service.Run(); //var bytes = Resources.GetBytes(Resources.BinaryResources.JayDayService); //var asm = Assembly.Load(bytes); //var t = asm.GetType("JayDayService.Service"); //if (t != null) //{ // Display("Assembly Loaded", "Starting Service"); // serviceRun = t.GetMethod("Run"); // serviceInit = t.GetMethod("Init"); // serviceStop = t.GetMethod("Stop"); // // display is shared. // serviceInit.Invoke(null, new object[] { display_HD44780 }); // serviceRun.Invoke(null, null); // // PowerState.Reboot(true) .. to free up memory.. //} timer = new GT.Timer(10000); timer.Tick += new GT.Timer.TickEventHandler(timer_Tick); timer.Start(); }
private void rfidReader_IdReceived(RFIDReader sender, string e) { //cameraRetryTimer.Tick += cameraRetryTimer_Tick; timeOutTimer.Tick += timeOutTimer_Tick; if (authInProgress == false) { Debug.Print("RFID scanned: " + e); scannedRFID = e; if (cam.CameraReady) { authInProgress = true; cam.TakePicture(); timeOutTimer.Start(); } else { Debug.Print("Camera not ready"); /* cameraRetryTimer.Start(); * cameraRetryCount = 0; */ } } else { Debug.Print("Authentication already in progress"); } /*displayTE35.SimpleGraphics.Clear(); * displayTE35.SimpleGraphics.DisplayText("RFID scanned: " + e, fontNina, GT.Color.White, 10, 10);*/ }
/* * BOSCH SECTION */ private void InitSensor() { bool isNotActivated = true; while (isNotActivated) { try { bme280 = new BME280Device(0x76) { AltitudeInMeters = 239 }; isNotActivated = false; } catch (BME280Exception) { Debug.Print("Error during BME280 initiliazation"); } Thread.Sleep(5000); } // Sensor Timer GT.Timer sensorTimer = new GT.Timer(20000); sensorTimer.Tick += sensorTimer_Tick; sensorTimer.Start(); // Show first bme280 reading sensorTimer_Tick(null); }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { Debug.Print("Program Started"); GT.Timer timer = new GT.Timer(3000); timer.Tick += Timer_Tick; timer.Start(); }
GT.Timer timerPictureCaptured; // every second (1000ms) void ProgramStarted() { /******************************************************************************************* * Modules added in the Program.gadgeteer designer view are used by typing * their name followed by a period, e.g. button. or camera. * * Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.: * button.ButtonPressed +=<tab><tab> * * If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.: * GT.Timer timer = new GT.Timer(1000); // every second (1000ms) * timer.Tick +=<tab><tab> * timer.Start(); *******************************************************************************************/ // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging. Debug.Print("Program Started"); //Timer timer.Tick += timer_Tick; timer.Start(); timerPictureCaptured = new GT.Timer(9000); timerPictureCaptured.Tick += timerPictureCaptured_Tick; timerPictureCaptured.Start(); //Load windows mainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MainWindow)); resultWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.ResultWindow)); cameraWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.CameraWindow)); BtnLeer = (GHI.Glide.UI.Button)resultWindow.GetChildByName("BtnLeer"); BtnLeer.TapEvent += BtnLeer_TapEvent; GlideTouch.Initialize(); Glide.MainWindow = mainWindow; button.ButtonPressed += button_ButtonPressed; //Conexion a Internet this.ethernetJ11D.NetworkInterface.Open(); //this.ethernetJ11D.NetworkInterface.EnableStaticIP("200.9.176.102", "255.255.255.128", "200.9.176.2"); this.ethernetJ11D.NetworkInterface.EnableDhcp(); //this.ethernetJ11D.UseStaticIP("200.9.176.102", "255.255.255.128","200.9.176.2"); this.ethernetJ11D.UseThisNetworkInterface(); this.ethernetJ11D.NetworkDown += ethernetJ11D_NetworkDown; this.ethernetJ11D.NetworkUp += ethernetJ11D_NetworkUp; //Funciones de Camara camera.BitmapStreamed += camera_BitmapStreamed; camera.CameraConnected += camera_CameraConnected; camera.PictureCaptured += camera_PictureCaptured; systemState = State.Camera; //imagen del qr currentBitmap = new Bitmap(camera.CurrentPictureResolution.Width, camera.CurrentPictureResolution.Height); }
void ProgramStarted() { Debug.Print("Initialization Started: " + DateTime.Now); Microsoft.SPOT.Hardware.PowerState.ChangePowerLevel(Microsoft.SPOT.Hardware.PowerLevel.High); led1.TurnRed(); led2.TurnOff(); sdCard.SDCardMounted += sdCard_SDCardMounted; sdCard.SDCardUnmounted += sdCard_SDCardUnmounted; rfid.CardIDReceived += rfid_CardIDReceived; rfid.CardIDBadChecksum += rfid_CardIDBadChecksum; try { rs232.Initialize(38400, GTI.Serial.SerialParity.None, GTI.Serial.SerialStopBits.None, 8, GTI.Serial.HardwareFlowControl.NotRequired); rs232.serialPort.DataReceived += serialPort_DataReceived; rs232.serialPort.LineReceived += serialPort_LineReceived; } catch (Exception exc) { Debug.Print("failed to init rs232: " + exc.Message); } GT.Timer timer = new GT.Timer(1000); // every second (1000ms) timer.Tick += timer_Tick; timer.Start(); Debug.Print("Program Started: " + DateTime.Now); }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { /******************************************************************************************* Modules added in the Program.gadgeteer designer view are used by typing their name followed by a period, e.g. button. or camera. Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.: button.ButtonPressed +=<tab><tab> If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.: GT.Timer timer = new GT.Timer(1000); // every second (1000ms) timer.Tick +=<tab><tab> timer.Start(); *******************************************************************************************/ // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging. Debug.Print("Program Started"); bluetooth.SetDeviceName("Gadgeteer"); bluetooth.BluetoothStateChanged += new Bluetooth.BluetoothStateChangedHandler(bluetooth_BluetoothStateChanged); bluetooth.DataReceived += new Bluetooth.DataReceivedHandler(bluetooth_DataReceived); //The timer gives the device enough time to initialize. Gadgeteer.Timer timer = new Gadgeteer.Timer(1000, Gadgeteer.Timer.BehaviorType.RunOnce); timer.Tick += new Gadgeteer.Timer.TickEventHandler(timer_Tick); timer.Start(); }
private void setupJoystick() { joystick.Calibrate(); timer_joystick = new GT.Timer(200); timer_joystick.Tick += joystick_function; timer_joystick.Start(); }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { /******************************************************************************************* Modules added in the Program.gadgeteer designer view are used by typing their name followed by a period, e.g. button. or camera. Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.: button.ButtonPressed +=<tab><tab> If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.: GT.Timer timer = new GT.Timer(1000); // every second (1000ms) timer.Tick +=<tab><tab> timer.Start(); *******************************************************************************************/ // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging. Debug.Print("Program Started"); var timer = new GT.Timer(250); timer.Tick += timer1 => { if (!tripWire.TripWire1.Read()) Debug.Print("TripWire1"); if (!tripWire.TripWire2.Read()) Debug.Print("TripWire2"); if (!tripWire.TripWire3.Read()) Debug.Print("TripWire3"); if (!tripWire.TripWire4.Read()) Debug.Print("TripWire4"); if (!tripWire.TripWire5.Read()) Debug.Print("TripWire5"); if (!tripWire.TripWire6.Read()) Debug.Print("TripWire6"); if (!tripWire.TripWire7.Read()) Debug.Print("TripWire7"); }; timer.Start(); }
void ProgramStarted() { SetupUI(); camera.PictureCaptured += new Camera.PictureCapturedEventHandler(camera_PictureCaptured); timer.Tick += new GT.Timer.TickEventHandler(timer_Tick); timer.Start(); }
void ProgramStarted() { var timer = new GT.Timer(50); timer.Tick += new GT.Timer.TickEventHandler(timer_Tick); timer.Start(); }
private void rfidReader_IdReceived(RFIDReader sender, string e) { if (authInProgress == false) { displayText("RFID scanned: " + e); scannedRFID = e; if (camera.CameraReady) { authInProgress = true; camera.TakePicture(); timeOutTimer.Start(); } else { displayText("Camera not ready"); /* cameraRetryTimer.Start(); * cameraRetryCount = 0; */ } } else { displayText("Authentication already in progress"); } }
private void pubTimer(int time = 20000) { GT.Timer timer = new GT.Timer(time); timer.Tick += (s) => MeasureOrchestrator.publish(); MeasureDB.Timer = timer; timer.Start(); }
private void pubOldTimer(int time = 20000) { GT.Timer timer = new GT.Timer(time); timer.Tick += (s) => { s.Stop(); mqtt.PublishOld(MeasureOrchestrator.id); s.Start(); }; MeasureDB.Timer = timer; timer.Start(); }
void setTimerInterval(int newIntervalPosition) { intervalPosition = newIntervalPosition; TimeSpan interval = new TimeSpan(0, 0, 0, 0, intervals[intervalPosition] * 1000); if (timer != null) { timer.Stop(); } else { timer = new GT.Timer(interval); timer.Tick += new GT.Timer.TickEventHandler(timer_Tick); } if (intervalPosition == 0) { DisplayMessage("Camera Off"); } else { timer.Interval = interval; timer.Start(); DisplayMessage("Interval Set to: " + intervals[intervalPosition] + " seconds"); } }
/// <summary> /// Resumes the USB host controller from a suspended state. /// </summary> public void Wakeup() { lock (_lock) { if (!isAsleep) { return; } if (_wakedt == null) { _wakedt = new Gadgeteer.Timer(_holdRI); _wakedt.Tick += new Gadgeteer.Timer.TickEventHandler(wakedt_Tick); } if (!_wakedt.IsRunning && !_glitchdt.IsRunning) { if (_glitchdt == null) { _glitchdt = new Gadgeteer.Timer(_glitchTime); _glitchdt.Tick += new Gadgeteer.Timer.TickEventHandler(_glitchdt_Tick); } //_RIBar.Write(false); _wakedt.Start(); _glitchdt.Start(); } } }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { Debug.Print("Program Started"); FlashAllLedsOnce(); var timer = new GT.Timer(100); timer.Tick += timer_Tick; timer.Start(); }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { joystick.JoystickPressed += new GTM.GHIElectronics.Joystick.JoystickEventHandler(joystick_JoystickPressed); button.ButtonPressed += new GTM.GHIElectronics.Button.ButtonEventHandler(button_ButtonPressed); GT.Timer timer = new GT.Timer(100); timer.Tick += new GT.Timer.TickEventHandler(timer_Tick); timer.Start(); }
public Gas(GasSense g, Wifi wifi) { this.wifi = wifi; this.gs = g; _getReading.Tick += new GT.Timer.TickEventHandler(_getReading_Tick); _preheat.Tick += new GT.Timer.TickEventHandler(_preheat_Tick); _getReading.Start(); }
// Relay Start Timer void RelayStartTimer_Tick(GT.Timer timer) { Relay.DisableRelay(2); Relay.DisableRelay(4); RelayStartTimer.Stop(); RelayStopTimer.Start(); }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { GT.Timer t = new GT.Timer(1000); t.Tick += new GT.Timer.TickEventHandler(connect); t.Start(); Debug.Print("Program Started"); }
public LedStripAnnunciator() { _ledStrip = new GTM.GHIElectronics.LEDStrip(11); GT.Timer timer = new GT.Timer(125); // Create a timer timer.Tick += Timer_Tick; timer.Start(); // Start the timer }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { GT.Timer timer = new GT.Timer(200); // every second (1000ms) timer.Tick += timer_Tick; timer.Start(); // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging. Debug.Print("Program Started"); }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging. Debug.Print("Program Started"); var timer = new GT.Timer(250); timer.Tick += timer1 => Debug.Print(moistureSensor.GetMoistureReading().ToString()); timer.Start(); }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { Debug.Print("Program Started"); _timer = new GT.Timer(1000); _timer.Tick += new GT.Timer.TickEventHandler(_timer_Tick); _timer.Start(); //button.ButtonPressed += new GTM.GHIElectronics.Button.ButtonEventHandler(button_ButtonPressed); }
public Devices(Button button, Wifi wifi) { this.wifi = wifi; blueT = new Gadgeteer.Bluetooth(8); this.button = button; t = new GT.Timer(100); t.Tick += new GT.Timer.TickEventHandler(start); t.Start(); Debug.Print("devices"); }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { Debug.Print("Program Started"); GT.Socket thermoSocket = GT.Socket.GetSocket(thermoExtender.ExtenderSocketNumber, true, thermoExtender, null); thermometer = new DS18B20(thermoSocket.CpuPins[4]); var thermoTimer = new GT.Timer(1000); thermoTimer.Tick += timer => Debug.Print(thermometer.ConvertAndReadTemperature().ToString()); thermoTimer.Start(); }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { Debug.Print("Program Started"); _relay = extender.SetupDigitalOutput(Socket.Pin.Three, _relayState); var timer = new GT.Timer(1000); timer.Tick += timer1 => { _relayState = !_relayState; _relay.Write(_relayState); }; timer.Start(); }
public MeasurementService( Moisture moistureSensor, LightSense lightSensor, IInternetOfThingsService internetOfThingsService) { _moistureSensor = moistureSensor; _lightSensor = lightSensor; _internetOfThingsService = internetOfThingsService; // Measure every second. _measurementsTimer = new Timer(new TimeSpan(0, 0, 0, 1)); _measurementsTimer.Tick += measurementsTimer_Tick; _measurementsTimer.Start(); }
void motion_Sensor_Motion_Sensed(Motion_Sensor sender, Motion_Sensor.Motion_SensorState state) { multicolorLed.BlinkRepeatedly(GT.Color.Red); char_Display.Clear(); char_Display.PrintString("ID yourself!"); _rfidEnabled = true; ClearTimer(); _timer = new GT.Timer(10000); _timer.Tick += new GT.Timer.TickEventHandler(timer_Tick); _timer.Start(); }
void ProgramStarted() { HWConfig.Mainboard = Mainboard; HWConfig.SDCard = sdCard; HWConfig.Indicators = led_Strip; HWConfig.WiFi = wifi_RS21; HWConfig.Ethernet = ethernet_ENC28; HWConfig.Indicators.TurnAllLedsOff(); GT.Timer timer = new GT.Timer(500); timer.Tick += delegate(GT.Timer t) { t.Stop(); new Model().Start(); }; timer.Start(); //new Model().Start(); Mainboard.SetDebugLED(true); }
/// <summary>This method is run when the mainboard is powered up or reset</summary> public void ProgramStarted() { Debug.Print("Program Started"); this.canvas = new Canvas(); this.window = this.oledDisplay.WPFWindow; this.window.Child = this.canvas; Timer timer = new Timer(34); timer.Tick += new Timer.TickEventHandler(TimerTick); timer.Start(); game = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight); scoreFont = Resources.GetFont(Resources.FontResources.NinaB); joystick.JoystickReleased += new Joystick.JoystickEventHandler(Player1JoystickReleased); InitBall(); }
private void DisplayMessage(string message) { // hide image imageDisplay.Visibility = Visibility.Collapsed; // show label label.Visibility = Visibility.Visible; label.TextContent = message; label.UpdateLayout(); if (hideMessageTimer == null) { hideMessageTimer = new GT.Timer(1000); hideMessageTimer.Tick += new GT.Timer.TickEventHandler(hideMessage_Tick); hideMessageTimer.Start(); } else { hideMessageTimer.Restart(); } }
private void DisplayMessage(string message) { Debug.Print(message); _imageDisplay.Visibility = Visibility.Collapsed; _message.Visibility = Visibility.Visible; _message.TextContent = message; _message.UpdateLayout(); if (_timer == null) { _timer = new Timer(2500); _timer.Tick += TimerTick; _timer.Start(); } else { _timer.Restart(); } }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { hgd = new HomeOSGadgeteer.HomeOSGadgeteerDevice("MicrosoftResearch", "MoistureSensor", "abcdefgh", wifi, multicolorLed, null, usbSerial.SerialLine.PortName, null, null, () => { return GT.Timer.GetMachineTime() < RemoteControlLedEndTime; },false); resetButton.LEDMode = Button.LEDModes.OnWhilePressed; resetButton.ButtonPressed += new Button.ButtonEventHandler(resetButton_ButtonPressed); resetButton.ButtonReleased += new Button.ButtonEventHandler(resetButton_ButtonReleased); usbHost.USBDriveConnected += (sender,storagedevice) => hgd.StorageAttached(storagedevice); sdCard.SDCardMounted += (sender, storagedevice) => hgd.StorageAttached(storagedevice); hgd.SetupWebEvent("moisture").WebEventReceived += MoistureWebEventReceived; hgd.SetupWebEvent("led").WebEventReceived += LedWebEventReceived; GT.Timer moistureTimer = new GT.Timer(MoistureCheckPeriod); moistureTimer.Tick += new GT.Timer.TickEventHandler(moistureTimer_Tick); moistureTimer.Start(); // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging. Debug.Print("Program Started"); }
void ProgramStarted() { byte config = (byte)( (byte)MAX31865.ConfigValues.VBIAS_ON | (byte)MAX31865.ConfigValues.THREE_WIRE | (byte)MAX31865.ConfigValues.FILTER_50Hz); MAX31865_Instance.Initialize(GT.Socket.Pin.Three, GT.Socket.Pin.Six, config); //MAX31865_Instance.SetConvToAuto(); MAX31865_Instance.EnableFaultScanner(1000); MAX31865_Instance.FaultEvent += MAX31865_Instance_FaultEvent; PollTimer = new GT.Timer(500); PollTimer.Tick += PollTimer_Tick; PollTimer.Start(); MAX31865_Instance.DataReadyFarEvent += MAX31865_Instance_DataReadyFarEvent; Debug.Print("Program Started"); }
// This method is run when the mainboard is powered up or reset. void ProgramStarted() { /******************************************************************************************* Modules added in the Program.gadgeteer designer view are used by typing their name followed by a period, e.g. button. or camera. Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.: button.ButtonPressed +=<tab><tab> If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.: GT.Timer timer = new GT.Timer(1000); // every second (1000ms) timer.Tick +=<tab><tab> timer.Start(); *******************************************************************************************/ // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging. Debug.Print("Program Started"); GT.Socket ledSocket = GT.Socket.GetSocket(ledExtender.ExtenderSocketNumber, true, ledExtender, null); _ledStrip = new LedStripLPD8806(ledSocket, NUM_LEDS); _heartRateSensor = new GroveHeartRateSensor(GT.Socket.GetSocket(heartRateExtender.ExtenderSocketNumber, true, heartRateExtender, null), 40); _heartRateSensor.HeartBeat += (sender, time) => { Debug.Print(@" --\"); Debug.Print(@" > [BPM: " + _heartRateSensor.BeatsPerMinute + "]"); Debug.Print(@" --/"); BlinkAll(); }; var timer1 = new GT.Timer(250); timer1.Tick += timer => Debug.Print(@" |"); timer1.Start(); //oledDisplay.SimpleGraphics.BackgroundColor = GT.Color.Red; //oledDisplay.SimpleGraphics.DisplayTextInRectangle("Now running!", 2, 2, 120, 20, GT.Color.Black, Resources.GetFont(Resources.FontResources.NinaB)); }
void ProgramStarted() { //INITIALIZING : Memory Card RemovableMedia.Insert += new InsertEventHandler(RemovableMedia_Insert); RemovableMedia.Eject += new EjectEventHandler(RemovableMedia_Eject); //INITIALIZING : Wireless network NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged; NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged; //INITIALIZING : Startup Gadgeteer.Timer networkTimer = new Gadgeteer.Timer(500, Gadgeteer.Timer.BehaviorType.RunOnce); networkTimer.Tick += new Gadgeteer.Timer.TickEventHandler(TimerTick_Startup); networkTimer.Start(); }
Boolean coffeeMachineOn() { Debug.Print("Setting coffeeMachine ON"); // set state of the device coffeeMachineState = CoffeeMachineState.ON; // This is needed as the the command may come from orchestrator.js, end hence is run in different thread! //Program.BeginInvoke(new DispatcherOperationCallback(delegate //{ onBtnBorder.Background = selectedONAndLoadedBackgroundBrush; offBtnBorder.Background = unselectedBackgroundBrush; loadedBtnBorder.Background = unselectedBackgroundBrush; timeUntilCoffeeReady = COFFEE_MAKE_TIME; timeUntilCoffeeReadyTimer = new GT.Timer(1000); timeUntilCoffeeReadyTimer.Tick += new GT.Timer.TickEventHandler((timer) => { if (timeUntilCoffeeReady == 0) timerText.TextContent = "coffee ready"; else timerText.TextContent = "" + timeUntilCoffeeReady; timeUntilCoffeeReady -= 1; if (timeUntilCoffeeReady < 0) { timeUntilCoffeeReadyTimer.Stop(); } }); timeUntilCoffeeReadyTimer.Start(); // the actual functionality coffeeRelay.TurnOff(); // return null; //}), ""); return true; }