Пример #1
0
 public GraphViewModel(ISenseHat senseHat)
 {
     _senseHat = senseHat;
     Temperature = new ObservableCollection<SensorReading>();
     Humidity = new ObservableCollection<SensorReading>();
     Pressure = new ObservableCollection<SensorReading>();
 }
Пример #2
0
		private static bool AlsoUseHdmiOutput = false; // Set this to true/false whether you have a display connected to the HDMI port of the Raspberry Pi!

		public static SenseHatDemo GetDemo(ISenseHat senseHat, Action<string> setScreenText)
		{
			if (!AlsoUseHdmiOutput)
			{
				// If you don't utilize the HDMI output, set the setScreenText parameter to null.
				setScreenText = null;
			}

			//return new DiscoLights(senseHat); // Click on the joystick to change drawing mode!

			//return new JoystickPixel(senseHat, setScreenText); // Use the joystick to move the pixel around.

			//return new WriteTemperature(senseHat, setScreenText); // Is it only me or does it show some unusual high temperature? :-S

			//return new GravityBlob(senseHat, setScreenText); // The green blob is drawn to the center of the earth! If you hold it upside down it gets angry and turns red. :-O

			//return new Compass(senseHat, setScreenText); // Note! You must calibrate the magnetic sensor by moving the Raspberry Pi device around in an 'eight' figure a few seconds at startup!

			//return new SingleColorScrollText(senseHat, "Hello Raspberry Pi 3 Sense HAT!"); // Click on the joystick to change drawing mode!

			//return new MultiColorScrollText(senseHat, "Hello Raspberry Pi 3 Sense HAT!");

			//return new SpriteAnimation(senseHat); // Use the joystick to move Mario. The middle button switches orientation and flipping of the drawing.

			//return new GammaTest(senseHat); // Tries out different gamma settings for the LED display. Use the joystick to play around.

			return new ReadAllSensors(senseHat, setScreenText); // Shows an example of how to read all the different sensors.
		}
Пример #3
0
        public async Task initSenseHat()
        {

            // Create sensehat object
            senseHat = await SenseHatFactory.Singleton.Create();

            // Init font
            tinyFont = new TinyFont();
            // Init display
            display = senseHat.Display;
            // Get a copy of the rainbow colors.
            senseHat.Display.Reset();
            // Recreate the font from the serialized bytes.
            BwFont font = BwFont.Deserialize(FontBytes);
            // Get the characters to scroll.
            IEnumerable<BwCharacter> characters = font.GetChars("Error");
            // Create the character renderer.
            BwCharacterRenderer characterRenderer = new BwCharacterRenderer(GetCharacterColor);
            // Create the text scroller.
            textScroller = new TextScroller<BwCharacter>(senseHat.Display, characterRenderer, characters);


            // Update forecast for first time
            getWeather(currentCity);

            // Check joystick every 100 ms
            joystickPollTimer = ThreadPoolTimer.CreatePeriodicTimer(pollJoystick, TimeSpan.FromMilliseconds(50));
            // Check sensor every 2 s
            updateSensorsTimer = ThreadPoolTimer.CreatePeriodicTimer(updateSensors, TimeSpan.FromSeconds(2));
            // Get updated weather every 1 minute
            forecastUpdateTimer = ThreadPoolTimer.CreatePeriodicTimer(updateForecast, TimeSpan.FromMinutes(1));
        }
Пример #4
0
 public TemperatureViewModel(ISenseHat senseHat)
     : base(senseHat)
 {
     this.Title = "Temperature";
     this.Unit = "C";
     this.Minimum = -10;
     this.Maximum = 100;
 }
Пример #5
0
 public PressureViewModel(ISenseHat senseHat)
     : base(senseHat)
 {
     this.Title = "Pressure";
     this.Unit = "mbar";
     this.Minimum = 1000;
     this.Maximum = 1050;
 }
Пример #6
0
		public static SenseHatDemo GetDemo(ISenseHat senseHat)
		{
			//return new DiscoLights(senseHat); // Click on the joystick to change drawing mode!

			//return new JoystickPixel(senseHat); // Use the joystick to move the pixel around.

			//return new WriteTemperature(senseHat); // Is it only me or does it show some unusual high temperature? :-S

			//return new GravityBlob(senseHat); // The green blob is drawn to the center of the earth! If you hold it upside down it gets angry and turns red. :-O

			//return new Compass(senseHat); // Note! You must calibrate the magnetic sensor by moving the Raspberry Pi device around in an 'eight' figure a few seconds at startup!

			//return new BwScrollText(senseHat, "Hello Raspberry Pi 2 Sense HAT!"); // Click on the joystick to change drawing mode!

			return new SpriteAnimation(senseHat); // Use the joystick to move Mario. The middle button switches orientation and flipping of the drawing.

			//return new GammaTest(senseHat); // Tries out different gamma settings for the LED display. Use the joystick to play around.
		}
Пример #7
0
		public JoystickPixel(ISenseHat senseHat, Action<string> setScreenText)
			: base(senseHat, setScreenText)
		{
		}
 public static SenseHatDemo GetDemo(ISenseHat senseHat)
 {
     return new SideScroller(senseHat);
 }
 public WriteTemperature(ISenseHat senseHat, Action <string> setScreenText)
     : base(senseHat, setScreenText)
 {
 }
Пример #10
0
 public RgbAction(ISenseHat senseHat) : base(senseHat)
 {
 }
Пример #11
0
		public WriteTemperature(ISenseHat senseHat)
			: base(senseHat)
		{
		}
Пример #12
0
 public Compass(ISenseHat senseHat)
     : base(senseHat)
 {
 }
Пример #13
0
 public GammaTest(ISenseHat senseHat, MainPage mainPage)
     : base(senseHat, mainPage)
 {
 }
Пример #14
0
 public Compass(ISenseHat senseHat, MainPage mainPage)
     : base(senseHat, mainPage)
 {
 }
Пример #15
0
 public ClockAction(ISenseHat senseHat) : base(senseHat)
 {
 }
Пример #16
0
 public GravityBlob(ISenseHat senseHat, MainPage mainPage)
     : base(senseHat, mainPage)
 {
 }
Пример #17
0
		protected SenseHatDemo(ISenseHat senseHat, Action<string> setScreenText = null)
		{
			SetScreenText = setScreenText;
			SenseHat = senseHat;
		}
Пример #18
0
 public WriteTemperature(ISenseHat senseHat)
     : base(senseHat)
 {
 }
Пример #19
0
 public HelloAction(ISenseHat senseHat) : base(senseHat)
 {
 }
Пример #20
0
		protected SenseHatDemo(ISenseHat senseHat)
		{
			SenseHat = senseHat;
		}
Пример #21
0
 public JoystickPixel(ISenseHat senseHat, MainPage mainPage)
     : base(senseHat, mainPage)
 {
 }
Пример #22
0
		public GammaTest(ISenseHat senseHat)
			: base(senseHat)
		{
		}
 public SenseHatTemperatureDisplay(ISenseHat senseHat)
 {
     _senseHat = senseHat;
 }
Пример #24
0
		public JoystickPixel(ISenseHat senseHat)
			: base(senseHat)
		{
		}
Пример #25
0
 public OffAction(ISenseHat senseHat) : base(senseHat)
 {
 }
Пример #26
0
		public DiscoLights(ISenseHat senseHat)
			: base(senseHat)
		{
		}
Пример #27
0
 protected SenseHatDemo(ISenseHat senseHat, Action <string> setScreenText = null)
 {
     SetScreenText = setScreenText;
     SenseHat      = senseHat;
 }
Пример #28
0
 public GammaTest(ISenseHat senseHat)
     : base(senseHat)
 {
 }
Пример #29
0
 public JoystickPixel(ISenseHat senseHat, Action <string> setScreenText)
     : base(senseHat, setScreenText)
 {
 }
Пример #30
0
 public WritePressure(ISenseHat senseHat, Action <string> setScreenText)
     : base(senseHat, setScreenText)
 {
 }
Пример #31
0
 private async Task InitializeSenseHatAsync()
 {
     SenseHat = await SenseHatFactory.Singleton.GetSenseHat().ConfigureAwait(false);
 }
Пример #32
0
 public DiscoLights(ISenseHat senseHat)
     : base(senseHat)
 {
 }
Пример #33
0
 public BinaryClock(ISenseHat senseHat, Action <string> setScreenText)
     : base(senseHat, setScreenText)
 {
 }
Пример #34
0
 protected SenseHatDemo(ISenseHat senseHat, MainPage mainPage)
 {
     MainPage = mainPage;
     SenseHat = senseHat;
 }
Пример #35
0
 public SingleColorScrollText(ISenseHat senseHat, string scrollText)
     : base(senseHat)
 {
     _scrollText = scrollText;
 }
Пример #36
0
 public AccelerometerSensor(ISenseHat senseHat)
     : base(senseHat)
 {
 }
Пример #37
0
		public GravityBlob(ISenseHat senseHat, Action<string> setScreenText)
			: base(senseHat, setScreenText)
		{
		}
Пример #38
0
 public JoystickPixel(ISenseHat senseHat)
     : base(senseHat)
 {
 }
Пример #39
0
 public Compass(ISenseHat senseHat, Action <string> setScreenText)
     : base(senseHat, setScreenText)
 {
 }
Пример #40
0
 protected SenseHatUtility(ISenseHat senseHat)
 {
     SenseHat = senseHat;
 }
Пример #41
0
		public WriteTemperature(ISenseHat senseHat, Action<string> setScreenText)
			: base(senseHat, setScreenText)
		{
		}
 public SideScroller(ISenseHat senseHat)
     : base(senseHat)
 {
 }
Пример #43
0
		public Compass(ISenseHat senseHat, Action<string> setScreenText)
			: base(senseHat, setScreenText)
		{
		}
Пример #44
0
 public WriteTemperature(ISenseHat senseHat, MainPage mainPage)
     : base(senseHat, mainPage)
 {
 }
Пример #45
0
 public DiscoLights(ISenseHat senseHat, MainPage mainPage)
     : base(senseHat, mainPage)
 {
 }
Пример #46
0
		public ColorScrollText(ISenseHat senseHat, string scrollText)
			: base(senseHat)
		{
			_scrollText = scrollText;
		}
Пример #47
0
 public MultiColorScrollText(ISenseHat senseHat, MainPage mainPage, string scrollText)
     : base(senseHat, mainPage)
 {
     _scrollText = scrollText;
 }
Пример #48
0
		public SpriteAnimation(ISenseHat senseHat)
			: base(senseHat)
		{
		}
Пример #49
0
 protected SenseHatDemo(ISenseHat senseHat)
 {
     SenseHat = senseHat;
 }
Пример #50
0
		public GravityBlob(ISenseHat senseHat)
			: base(senseHat)
		{
		}
Пример #51
0
 public GravityBlob(ISenseHat senseHat)
     : base(senseHat)
 {
 }
Пример #52
0
 public SensorViewModel(ISenseHat senseHat)
 {
     _senseHat = senseHat;
 }
 public GravityBlob(ISenseHat senseHat, Action <string> setScreenText)
     : base(senseHat, setScreenText)
 {
 }
Пример #54
0
 public ReadAllSensors(ISenseHat senseHat, Action <string> setScreenText)
     : base(senseHat, setScreenText)
 {
 }
Пример #55
0
 public snake(ISenseHat senseHat)
     : base(senseHat)
 {
 }
Пример #56
0
 public TemperatureSensor(ISenseHat senseHat)
     : base(senseHat)
 {
 }
Пример #57
0
 public SpriteAnimation(ISenseHat senseHat)
     : base(senseHat)
 {
 }