public override void Run() { // Get a copy of the rainbow colors. SenseHat.Display.Reset(); SenseHat.Display.CopyScreenToColors(_rainbowColors); // Recreate the font from the serialized bytes. SingleColorFont font = SingleColorFont.Deserialize(FontBytes); // Get the characters to scroll. _scrollText = "Initial Text"; SetScreenText(_scrollText); // create the caracters IEnumerable <SingleColorCharacter> characters = font.GetChars(_scrollText); // Create the character renderer. SingleColorCharacterRenderer characterRenderer = new SingleColorCharacterRenderer(GetCharacterColor); // Create the text scroller. var textScroller = new TextScroller <SingleColorCharacter>( SenseHat.Display, characterRenderer, characters); while (true) { // Change the scrolltext to DateTime now. _scrollText = DateTime.Now.ToString("HH:mm:ss yyyy-MM-dd"); // set the Text of the GUI SetScreenText(_scrollText); // get characters from String characters = font.GetChars(_scrollText); // Update Textscroller with new characters textScroller.setCharacters(characters); // Step the scroller. if (!textScroller.Step()) { // Reset the scroller when reaching the end. textScroller.Reset(); } // Draw the background. FillDisplay(textScroller.ScrollPixelOffset); // Draw the scroll text. textScroller.Render(); // Update the physical display. SenseHat.Display.Update(); // Should the drawing mode change? if (SenseHat.Joystick.Update() && (SenseHat.Joystick.EnterKey == KeyState.Pressing)) { // The middle button is just pressed. SwitchToNextScrollMode(); } // Pause for a short while. Sleep(TimeSpan.FromMilliseconds(50)); } }