void timer_Tick(Gadgeteer.Timer timer) { temperature = thermocouple.GetExternalTemperature(); DC.DCPushTemperature tem = new DC.DCPushTemperature() { Temperature = temperature }; string jsonRequest = Json.NETMF.JsonSerializer.SerializeObject(tem); POSTContent postData = POSTContent.CreateTextBasedContent(jsonRequest); var reqData = HttpHelper.CreateHttpPostRequest("http://simil.cloudapp.net/SmartFridgeServer/Api/Fridge/PushTemperature", postData, "application/json"); reqData.ResponseReceived += reqData_ResponseReceived; reqData.SendRequest(); if (OnTemRead != null) { OnTemRead(this, null); } }
private void BlinkTick(Gadgeteer.Timer timer) { var memory = Debug.GC(false); Debug.Print("Tick! Memory = " + memory); _modeRunner.Tick(); }
private void set_heartbeat_timer() { heartbeat_timer2 = new Gadgeteer.Timer(HEARTBEAT_INTERVAL); heartbeat_timer2.Tick += new Gadgeteer.Timer.TickEventHandler((timer) => { send_heartbeat(); }); heartbeat_timer2.Start(); }
public StatusMessageMonitor(Relay_X1 relayX1, ILoggerDisplay loggerDisplay) { _relayX1 = relayX1; _loggerDisplay = loggerDisplay; _username = "******" + Globals.UserName.ToLower(); // Check status messages every x seconds _statusCheckTimer = new Gadgeteer.Timer(StatusCheckInterval); _statusCheckTimer.Tick += StatusCheckTimerTick; }
void ProgramStarted() { /******************************************************************************************* * * Please write application below * *******************************************************************************************/ Gadgeteer.Timer timer = new Gadgeteer.Timer(5000); timer.Tick += timer_Tick; timer.Start(); Debug.Print("Program Started"); }
public void detectObstacle(Gadgeteer.Timer timer) { //if (Robot.robot.OBSTACLE_MANAGER.ObstacleChangeEvent == null) return; TODO : UNCOMMENT AFTER DEBUG bool obstacle = IsThereAnObstacle(); Informations.printInformations(Priority.VERY_LOW, "Obstacle IR : " + obstacle + "; lastStatus : " + lastStatus); if (obstacle != this.lastStatus) { this.lastStatus = obstacle; this.OnObstacleChange(obstacle); } }
private void InitializeWifi() { Debug.Print("SolarPulse - Initialize Wifi."); var connected = ConnectWifi(); if (connected) { lightTimer = new Gadgeteer.Timer(1000, Gadgeteer.Timer.BehaviorType.RunOnce); // every 1 second (1000ms) lightTimer.Tick += timer_Tick; lightTimer.Start(); this.ShowMainScreen(); } else { this.wifiInitializationTimer.Start(); } }
void Timer_Tick(Gadgeteer.Timer timer) { _Counter++; ConsoleDisplayN18.Write("Counter = " + _Counter + "s", 50, 50); MainHandle.LED_Strip.SetBitmask((uint)(_Counter % 65)); /*if ((_Counter % 2) == 0) * { * MainHandle.ButtonLeft.TurnLEDOn(); * MainHandle.ButtonRight.TurnLEDOff(); * } * else * { * MainHandle.ButtonLeft.TurnLEDOff(); * MainHandle.ButtonRight.TurnLEDOn(); * }*/ }
void timer_Tick(Gadgeteer.Timer timer) { Debug.Print("Tick=" + DateTime.Now.Ticks); var tempVal = Mainboard.TemperatureSensor.TakeMeasurements(); var accelVal = Mainboard.AccelerometerSensor.TakeMeasurements(); Debug.Print("T=" + tempVal.Temperature); Debug.Print("Accelerometer:X=" + accelVal.X + ",Y=" + accelVal.Y + ",Z=" + accelVal.Z); if (relayStatus) { Mainboard.Relay.TurnOn(); } else { Mainboard.Relay.TurnOff(); } relayStatus = !relayStatus; }
private void SetupTimers() { _timerBlink = new Gadgeteer.Timer(500); _timerBlink.Tick += BlinkTick; _timerBlink.Start(); }
public void StartChecking() { Gadgeteer.Timer timer = new Gadgeteer.Timer(20000); timer.Tick += timer_Tick; timer.Start(); }
void Timer_Tick(Gadgeteer.Timer timer) { Do(); }
// 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(); *******************************************************************************************/ this.InitializeDisplay(); this.ShowSplashScreen(); this.wifiInitializationTimer = new Gadgeteer.Timer(1000, Gadgeteer.Timer.BehaviorType.RunOnce); wifiInitializationTimer.Tick += timer => { this.InitializeWifi(); }; wifiInitializationTimer.Start(); var bluetoothInitializationTimer = new Gadgeteer.Timer(1000, Gadgeteer.Timer.BehaviorType.RunOnce); bluetoothInitializationTimer.Tick += timer => { this.InitializeBluetooth(); }; bluetoothInitializationTimer.Start(); // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging. Debug.Print("Program Started"); }