public GraphViewModel(ISenseHat senseHat) { _senseHat = senseHat; Temperature = new ObservableCollection<SensorReading>(); Humidity = new ObservableCollection<SensorReading>(); Pressure = new ObservableCollection<SensorReading>(); }
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. }
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)); }
public TemperatureViewModel(ISenseHat senseHat) : base(senseHat) { this.Title = "Temperature"; this.Unit = "C"; this.Minimum = -10; this.Maximum = 100; }
public PressureViewModel(ISenseHat senseHat) : base(senseHat) { this.Title = "Pressure"; this.Unit = "mbar"; this.Minimum = 1000; this.Maximum = 1050; }
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. }
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) { }
public RgbAction(ISenseHat senseHat) : base(senseHat) { }
public WriteTemperature(ISenseHat senseHat) : base(senseHat) { }
public Compass(ISenseHat senseHat) : base(senseHat) { }
public GammaTest(ISenseHat senseHat, MainPage mainPage) : base(senseHat, mainPage) { }
public Compass(ISenseHat senseHat, MainPage mainPage) : base(senseHat, mainPage) { }
public ClockAction(ISenseHat senseHat) : base(senseHat) { }
public GravityBlob(ISenseHat senseHat, MainPage mainPage) : base(senseHat, mainPage) { }
protected SenseHatDemo(ISenseHat senseHat, Action<string> setScreenText = null) { SetScreenText = setScreenText; SenseHat = senseHat; }
public HelloAction(ISenseHat senseHat) : base(senseHat) { }
protected SenseHatDemo(ISenseHat senseHat) { SenseHat = senseHat; }
public JoystickPixel(ISenseHat senseHat, MainPage mainPage) : base(senseHat, mainPage) { }
public GammaTest(ISenseHat senseHat) : base(senseHat) { }
public SenseHatTemperatureDisplay(ISenseHat senseHat) { _senseHat = senseHat; }
public JoystickPixel(ISenseHat senseHat) : base(senseHat) { }
public OffAction(ISenseHat senseHat) : base(senseHat) { }
public DiscoLights(ISenseHat senseHat) : base(senseHat) { }
protected SenseHatDemo(ISenseHat senseHat, Action <string> setScreenText = null) { SetScreenText = setScreenText; SenseHat = senseHat; }
public JoystickPixel(ISenseHat senseHat, Action <string> setScreenText) : base(senseHat, setScreenText) { }
public WritePressure(ISenseHat senseHat, Action <string> setScreenText) : base(senseHat, setScreenText) { }
private async Task InitializeSenseHatAsync() { SenseHat = await SenseHatFactory.Singleton.GetSenseHat().ConfigureAwait(false); }
public BinaryClock(ISenseHat senseHat, Action <string> setScreenText) : base(senseHat, setScreenText) { }
protected SenseHatDemo(ISenseHat senseHat, MainPage mainPage) { MainPage = mainPage; SenseHat = senseHat; }
public SingleColorScrollText(ISenseHat senseHat, string scrollText) : base(senseHat) { _scrollText = scrollText; }
public AccelerometerSensor(ISenseHat senseHat) : base(senseHat) { }
public GravityBlob(ISenseHat senseHat, Action<string> setScreenText) : base(senseHat, setScreenText) { }
public Compass(ISenseHat senseHat, Action <string> setScreenText) : base(senseHat, setScreenText) { }
protected SenseHatUtility(ISenseHat senseHat) { SenseHat = senseHat; }
public WriteTemperature(ISenseHat senseHat, Action<string> setScreenText) : base(senseHat, setScreenText) { }
public SideScroller(ISenseHat senseHat) : base(senseHat) { }
public Compass(ISenseHat senseHat, Action<string> setScreenText) : base(senseHat, setScreenText) { }
public WriteTemperature(ISenseHat senseHat, MainPage mainPage) : base(senseHat, mainPage) { }
public DiscoLights(ISenseHat senseHat, MainPage mainPage) : base(senseHat, mainPage) { }
public ColorScrollText(ISenseHat senseHat, string scrollText) : base(senseHat) { _scrollText = scrollText; }
public MultiColorScrollText(ISenseHat senseHat, MainPage mainPage, string scrollText) : base(senseHat, mainPage) { _scrollText = scrollText; }
public SpriteAnimation(ISenseHat senseHat) : base(senseHat) { }
public GravityBlob(ISenseHat senseHat) : base(senseHat) { }
public SensorViewModel(ISenseHat senseHat) { _senseHat = senseHat; }
public GravityBlob(ISenseHat senseHat, Action <string> setScreenText) : base(senseHat, setScreenText) { }
public ReadAllSensors(ISenseHat senseHat, Action <string> setScreenText) : base(senseHat, setScreenText) { }
public snake(ISenseHat senseHat) : base(senseHat) { }
public TemperatureSensor(ISenseHat senseHat) : base(senseHat) { }