Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Threading;
- using Microsoft.SPOT;
- using Microsoft.SPOT.Presentation;
- using Microsoft.SPOT.Presentation.Controls;
- using Microsoft.SPOT.Presentation.Media;
- using Microsoft.SPOT.Touch;
- using Gadgeteer.Networking;
- using GT = Gadgeteer;
- using GTM = Gadgeteer.Modules;
- using Gadgeteer.Modules.GHIElectronics;
- namespace GadgetProject02
- {
- public partial class Program
- {
- private DateTime startTime;
- private bool sensorState;
- void ProgramStarted()
- {
- Debug.Print("Program Started");
- //camera.TakePicture();
- startTime = DateTime.Now;
- //sensorState = motion_Sensor.SensorStillActive;
- motion_Sensor.Motion_Sensed += new GTM.GHIElectronics.Motion_Sensor.Motion_SensorEventHandler(motion_Sensor_Motion_Sensed);
- /*GT.Timer tmr = new GT.Timer(50, GT.Timer.BehaviorType.RunContinuously);
- tmr.Tick += new GT.Timer.TickEventHandler(tmr_Tick);
- tmr.Start();*/
- camera.PictureCaptured += new Camera.PictureCapturedEventHandler(camera_PictureCaptured);
- }
- void tmr_Tick(GT.Timer timer)
- {
- if (motion_Sensor.SensorStillActive != sensorState)
- {
- Debug.Print("State changed to: " + motion_Sensor.SensorStillActive + " @ " + (DateTime.UtcNow - startTime).ToString());
- sensorState = motion_Sensor.SensorStillActive;
- }
- }
- void motion_Sensor_Motion_Sensed(GTM.GHIElectronics.Motion_Sensor sender, GTM.GHIElectronics.Motion_Sensor.Motion_SensorState state)
- {
- Debug.Print("Time span = " + (DateTime.UtcNow - startTime).ToString());
- startTime = DateTime.UtcNow;
- Debug.Print("TRIGGER");
- camera.TakePicture();
- }
- void camera_PictureCaptured(Camera sender, GT.Picture picture)
- {
- //throw new NotImplementedException();
- display_T35.SimpleGraphics.DisplayImage(picture, 0, 0); // rodo vaizda
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment