public MathBot(IMathBotDevice device) { SoundUtilities.Volume = .1f; this.device = device; FaceManager = new FaceManager(device); FaceManager.LoadImages().ContinueWith(t => FaceManager.SetFace(Faces.Sad)); device.KeyPad.KeyPressed += Device_KeyPressed; var ignore = camera.Initialize(); //timer = new DispatcherTimer(); //timer.Interval = TimeSpan.FromSeconds(1); //timer.Tick += (a, b) => { SeeWithCamera(); }; //timer = new Timer(a => SeeWithCamera(), null, TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(1)); Task.Run(async() => { await Task.Delay(TimeSpan.FromSeconds(4)); while (true) { await SeeWithCamera(); //await Task.Delay(TimeSpan.FromSeconds(1)); } }); }
public MathBotDevice(IMathBotDevice me, byte brightness = 2) { this.me = me; // LCD LcdDisplay = new LcdDisplay(0x20); LcdDisplay.SetBacklight(true); // LED matrixes MouthDisplay = new LED8x8Matrix(new Ht16K33(new byte[] { 0x73, 0x74 }, new[] { Ht16K33.Rotate.None, Ht16K33.Rotate.D180 }, doubleWide: true)); LeftEyeDisplay = new LED8x8Matrix(new Ht16K33(new byte[] { 0x70 }, Ht16K33.Rotate.None)); RightEyeDisplay = new LED8x8Matrix(new Ht16K33(new byte[] { 0x71 }, Ht16K33.Rotate.None)); MouthDisplay.SetBrightness(brightness); LeftEyeDisplay.SetBrightness(brightness); RightEyeDisplay.SetBrightness(brightness); // Speaker ss.Voice = SpeechSynthesizer.AllVoices[0]; }
public MainPage() { this.InitializeComponent(); IMathBotDevice device = this.deviceIU; #if ARM // When running on ARM use the actual hardware device = new MathBotDevice(device); #endif bot = new MathBot(device); // for testing the displays device.KeyPad.KeyPressed += key => { if (key == KeyPadKey.Backspace) { var ignore = TestLedMatrix(device.LeftEyeDisplay); ignore = TestLedMatrix(device.RightEyeDisplay); ignore = TestLedMatrix(device.MouthDisplay); } }; }
public FaceManager(IMathBotDevice device) { this.device = device; }