def ripple_price(): url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol=XRP&convert=USD' headers = { 'Accept': 'application/json', 'Accept-Encoding': 'deflate, gzip', 'X-CMC_PRO_API_KEY': 'd49c4a54-e879-4f24-8a73-af853d3d444f', } r = requests.get(url, headers=headers) if r.status_code == 200: response = json.loads(r.text) price_usd = ("{0:.2f}".format( (response['data']['XRP']['quote']['USD']['price']))) market_cap_usd = ("{0:.2f}".format( (response['data']['XRP']['quote']['USD']['market_cap']))) cryptocurrency_name = response['data']['XRP']['slug'] fetch('The price of 1 Ripple is' + price_usd) play() scrollphathd.write_string('The price of ripple is: ' + price_usd + 'USD', brightness=0.25) length = scrollphathd.get_buffer_shape()[0] - 17 for x in range(length): scrollphathd.show() scrollphathd.scroll(1) time.sleep(0.04) time.sleep(1.5) scrollphathd.clear() scrollphathd.show()
def get_time(): scrollphathd.clear() scrollphathd.show() current_time = time.ctime() current_time = current_time[11:16] scrollphathd.write_string(current_time, x=0, y=1, font=font3x5) scrollphathd.show()
def wifi_main_loop(): while True: global count, signal_high, signal_low scr.clear() [id, s] = wifi_info() scr.fill(brightness=bright1, x=0, y=1, width=s - 1, height=height - 2) scr.fill(brightness=bright3, x=s - 1, y=1, width=1, height=height - 2) scr.fill(brightness=bright2, x=signal_high - 1, y=0, width=1, height=height - 1) scr.fill(brightness=bright2, x=signal_low - 1, y=1, width=1, height=height - 1) if (count > 0 and count <= 9): scr.set_pixel(x=0, y=3, brightness=bright) elif (count > 9 and count <= 19): #scr.clear_rect(0, 0, 1, 1) scr.set_pixel(x=0, y=3, brightness=bright2) elif (count >= 19): count = 0 count = count + 1 scr.show() time.sleep(delay)
def news(): # Put the Twitter usernames of the news organisations you want to read here twits = ["BBCNews", "GranadaReports", "SkyNews", "itvnews", "MENnewsdesk"] for index in range(len(twits)): # The count parameter defines how many tweets from each account you'll read tweets = api.get_user_timeline(screen_name=twits[index], count=3) for tweet in tweets: clean_tweet = '%s: %s' % (tweet['user']['screen_name'], tweet['text']) # This line clear URLs from the tweets clean_tweet = re.sub(r"(https?\://|http?\://|https?\:)\S+", "", clean_tweet) clean_tweet = clean_tweet.encode('ascii', 'ignore').decode('ascii') scrollphathd.write_string(clean_tweet, x=17, font=font5x7) tweet_length = scrollphathd.write_string( clean_tweet, x=17, y=0, font=font5x7) + 7 time.sleep(0.25) while tweet_length > 0: scrollphathd.show() scrollphathd.scroll() tweet_length -= 1 time.sleep(0.01) scrollphathd.clear() scrollphathd.show()
def show_pressure(): # Makes sure scrollphat buffer is clear sphd.clear() # Pressure value is fetched from weather module pressurevalue = (weather.pressure()) # Uses say_value() to speak the current pressure value speakpressure = ("The current pressure is " + str(round(pressurevalue / 1000, 1)) + " kilopascals") print(speakpressure) say_value(x=speakpressure) # Writes the currnet pressure value to scrollphat buffer sphd.write_string("Pressure: " + str(round(pressurevalue / 1000, 1)) + " kPa", brightness=0.25) # Length of buffer is calculated length = sphd.get_buffer_shape()[0] - 17 # Scrolls for the total length value for x in range(length): sphd.show() sphd.scroll(1) time.sleep(0.03) # Sleeps for 1 second once complete time.sleep(1) # Clears buffer and runs show() to clear display sphd.clear() sphd.show() # Makes sure all button LED's are turned off touchphat.all_off()
def loop1(): while True: if exitl1 == True: #print("loop 1 has been ended") time.sleep(5) else: if SLPFunc: now = datetime.now() timeNow = now.strftime("%H:%M") timeNow = datetime.strptime(timeNow, "%H:%M") if isNowInTimePeriod(SLPtimeStart, SLPtimeEnd, timeNow): scrollphathd.clear() scrollphathd.show() #time.sleep(120) else: clock() time.sleep(30) date() time.sleep(5) temp() time.sleep(5) else: clock() time.sleep(30) date() time.sleep(5) temp() time.sleep(5)
def show_light(): # Makes sure scrollphat buffer is clear sphd.clear() # variable is set to be the current light value lightvalue = light.light() # Uses say_value() to speak the current light level speaklight = ("The current light level is " + str(lightvalue)) print(speaklight) say_value(x=speaklight) # Light value is stored in scrollphat buffer lightoutput = (" Light: " + str(lightvalue)) sphd.write_string(lightoutput, brightness=0.25) # Length of buffer is calculated length = sphd.get_buffer_shape()[0] - 17 # Scrolls for the total length value for x in range(length): sphd.show() sphd.scroll(1) time.sleep(0.03) # Sleeps for 1 second once complete time.sleep(1) # Clears buffer and runs show() to clear display sphd.clear() sphd.show() # Makes sure all button LED's are turned off touchphat.all_off()
def show_temp(): # Makes sure scrollphat buffer is clear sphd.clear() # Declares local variable "degrees", fetches value form weather module and rounds to 1 decimal place degrees = round(weather.temperature(), 1) # Section that controls speach output # "speaktemp" string is set speaktemp = ("The temperature is currently " + str(degrees) + " degrees celcius") print(speaktemp) # "speaktemp" is passed into say_value() function say_value(speaktemp) # Section taht controls scrollphat output # "temperature" string is set temperature = (' Temp: ' + str(degrees) + 'C') # "temperature" string is written to sphd buffer sphd.write_string(temperature, brightness=0.25) # Length of buffer is calculated length = sphd.get_buffer_shape()[0] - 17 # Scrolls for the total length value for x in range(length): sphd.show() sphd.scroll(1) time.sleep(0.03) # Sleeps for 1 second once complete time.sleep(1) # Clears buffer and runs show() to clear display sphd.clear() sphd.show() # Makes sure all button LED's are turned off touchphat.all_off()
def show_datetime(): # Makes sure scrollphat buffer is clear sphd.clear() # Current date/time is stored in "currentDT" variable currentDT = datetime.datetime.now() # Prints the current time value print(currentDT.strftime("%I:%M %p")) # Uses say_value() to speak the current time speaktime = ("It is currently " + str(currentDT.strftime("%I:%M %p"))) print(speaktime) say_value(speaktime) sphd.write_string("Time: " + str(currentDT.strftime("%I:%M %p")), brightness=0.25) # Length of buffer is calculated length = sphd.get_buffer_shape()[0] - 17 # Scrolls for the total length value for x in range(length): sphd.show() sphd.scroll(1) time.sleep(0.03) # Sleeps for 1 second once complete time.sleep(1) # Clears buffer and runs show() to clear display sphd.clear() sphd.show() # Makes sure all button LED's are turned off touchphat.all_off()
def show(self): scrollphathd.clear() if self.mode == "clock": self.clock() elif self.mode == "demo": self.demo() if self.index >= 100: self.mode = "clock" self.index = 0 elif self.mode == "clock_vol": self.clock() self.gauge() if self.index >= 40: self.mode = "clock" self.index = 0 elif self.mode == "clock_vu": self.clock() self.vumeter() elif self.mode == "clock_butterfly": self.clock() self.butterfly() elif self.mode == "clock_scan": self.clock() self.scan() if self.index >= 64: self.mode = "clock" self.index = 0 scrollphathd.show() return
def largeHeart(b): sph.clear_rect(0, 0, 6, 7) sph.show() sph.set_pixel(0, 0, b / 2) sph.set_pixel(1, 0, b) sph.set_pixel(3, 0, b) sph.set_pixel(4, 0, b / 2) sph.set_pixel(0, 1, b) sph.set_pixel(1, 1, b) sph.set_pixel(2, 1, b) sph.set_pixel(3, 1, b) sph.set_pixel(4, 1, b) sph.set_pixel(0, 2, b) sph.set_pixel(1, 2, b) sph.set_pixel(2, 2, b) sph.set_pixel(3, 2, b) sph.set_pixel(4, 2, b) sph.set_pixel(0, 3, b / 2) sph.set_pixel(1, 3, b) sph.set_pixel(2, 3, b) sph.set_pixel(3, 3, b) sph.set_pixel(4, 3, b / 2) sph.set_pixel(1, 4, b) sph.set_pixel(2, 4, b) sph.set_pixel(3, 4, b) sph.set_pixel(1, 5, b / 2) sph.set_pixel(2, 5, b) sph.set_pixel(3, 5, b / 2) sph.set_pixel(2, 6, b) sph.show()
def main(): # Parser handling parser = ArgumentParser() parser.add_argument("-p", "--port", type=int, help="HTTP port.", default=8080) parser.add_argument("-H", "--host", type=str, help="HTTP host.", default="0.0.0.0") args = parser.parse_args() # TODO Check scrollphathd.set_clear_on_exit(False) scrollphathd.write_string(str(args.port), x=1, y=1, brightness=0.1) scrollphathd.show() # Flash usage app = Flask(__name__) app.register_blueprint(scrollphathd_blueprint, url_prefix="/scrollphathd") app.run(port=args.port, host=args.host) cleanup() # Shut down the scheduler when exiting the app state.get_scheduler().shutdown()
def do_swirl(self, this_program): def swirl(x, y, step): x -= (scrollphathd.DISPLAY_WIDTH / 2.0) y -= (scrollphathd.DISPLAY_HEIGHT / 2.0) dist = math.sqrt(pow(x, 2) + pow(y, 2)) angle = (step / 10.0) + dist / 1.5 s = math.sin(angle) c = math.cos(angle) xs = x * c - y * s ys = x * s + y * c r = abs(xs + ys) return max(0.0, 0.7 - min(1.0, r / 8.0)) while self.program == this_program and not self._got_stop_event(): timestep = math.sin(time.time() / 18) * 1500 for x in range(0, WIDTH): for y in range(0, HEIGHT): v = swirl(x, y, timestep) scrollphathd.pixel(x, y, v) scrollphathd.show() time.sleep(0.001)
def main(): brightness = 0 last_time = None show_colon = False ldr = LightSensor(LDR_PIN) if "flip" in sys.argv: sphd.rotate(180) while True: now = datetime.now() current_time = (now.hour, now.minute) old_brightness = brightness brightness = MAX_BRIGHTNESS if ldr.light_detected else 0.1 if current_time != last_time or brightness != old_brightness: sphd.clear() draw_digit(0, 0, now.hour // 10, brightness) draw_digit(4, 0, now.hour % 10, brightness) draw_digit(10, 0, now.minute // 10, brightness) draw_digit(14, 0, now.minute % 10, brightness) last_time = current_time if show_colon != (now.microsecond < 500000) or brightness != old_brightness: show_colon = now.microsecond < 500000 sphd.set_pixel(8, 1, brightness * show_colon) sphd.set_pixel(8, 5, brightness * show_colon) sphd.show() time.sleep(0.01)
def setPixel(): if request.is_json: schema = td["actions"]["setPixel"]["input"] valid_input = Draft6Validator(schema).is_valid(request.json) if valid_input: x = 5 y = 5 try: x = int(request.json["x"]) except Exception as e: print(e) try: y = int(request.json["y"]) except Exception as e: print(e) try: bright = float(request.json["brightness"]) scrollphathd.clear() scrollphathd.show() scrollphathd.set_pixel(x, y, bright) scrollphathd.show() return "", 204 except Exception as e: print(e) abort(400) else: abort(400) else: abort(415) # Wrong media type.
def run(self): global current_value next_value = 0.0 scrollphathd.set_font(font5x7) scrollphathd.set_brightness(0.2) scrollphathd.rotate(degrees=180) while self.running: if next_value == 0.0: next_value_string = "" else: next_value_string = self.format_value(next_value) if current_value == 0.0: curr_value_string = "loading.. " else: curr_value_string = self.format_value(current_value) next_value = current_value string_to_display = curr_value_string + next_value_string scrollphathd.clear() str_len = scrollphathd.write_string(string_to_display) for _ in range(str_len): scrollphathd.show() scrollphathd.scroll() time.sleep(0.05)
def graphAnim(): sphd.set_brightness(0.2) sphd.set_graph(values, 3, 7, 1.0, 0, 0, 17, 6) sphd.show() for index in range(0, 17): changeValue(index) time.sleep(0.008)
def drawHeart(): buffer1 = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ] buffer2 = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] animbuffer = [buffer1, buffer2] frames = 2 for loop in range(0, 10): pic = animbuffer[loop % frames] for pos in range(0, len(pic)): xpos = pos % 17 ypos = int(pos / 17) sphd.set_pixel(xpos, ypos, float(pic[pos])) sphd.show() time.sleep(1)
def processMessage(): timeout = time.time() + 60 * 1 - 10 while True: while not queue.empty(): #Pause clock thread message = queue.get() screenFlash() while time.time() < timeout: sphd.write_string(" " + message + " >>") sphd.set_brightness(0.5) sphd.show() sphd.scroll(1) time.sleep(0.05) sphd.clear() sphd.show() #Resume clock thread but keep this checking for messages def screenClear(): sphd.clear() sphd.show() def screenFlash(): sphd.fill(1, 0, 0, 17, 7) sphd.show() time.sleep(0.2) screenClear() sphd.fill(1, 0, 0, 17, 7) sphd.show() time.sleep(0.2) screenClear() sphd.fill(1, 0, 0, 17, 7) sphd.show() time.sleep(0.2) screenClear() time.sleep(1)
def sticker(memo, input, duration): '''Sticker Scroller by AZcoigreach''' try: click.clear() click.secho('Sticker Scroll Running...', fg='red') scrollphathd.rotate(degrees=180) tmp = str('') msg = ' .' scrollphathd.write_string(str(msg), font=font3x5, brightness=0.15) while True: data = pd.DataFrame(pickle.load(open(input, 'rb'))) datatest = str(data) logging.debug('data DataFrame: %s', datatest) logging.debug('tmp DataFrame: %s', tmp) if datatest != tmp: logging.info('Updating DataFrame...') tmp = str(data) data = data.tail(1) data = data.iloc[0, 3] msg = memo + str(data) scrollphathd.clear() scrollphathd.write_string(str(msg), font=font3x5, brightness=0.15) click.secho(msg, fg='yellow') logging.debug('Updating LED...') scrollphathd.show() scrollphathd.scroll() time.sleep(duration) except Exception as err: logger.error('Scroll Error: %s', err) time.sleep(5) sticker()
def clock(): scrollphathd.rotate(180) scrollphathd.clear() str1 = time.strftime("%H%M") scrollphathd.write_string(str1, x=1, y=1, font=font3x5, brightness=0.01) scrollphathd.show() time.sleep(0.1)
def displayPressure(startTime): """Render pressure data to the ScrollpHAT.""" global showTime global pressureReport targetTime = startTime + showTime scrollphathd.clear() scrollphathd.write_string(str(pressureReport), font=font5x5, brightness=BRIGHTNESS) scrollphathd.show() # print(pressureReport) while (time.time() < targetTime): time.sleep(0.05) scrollphathd.clear() # Round temperature report to 1 decimal place, and append Celsius unit for clarity tempString = str(round(tempReport, 1)) + "C" scrollphathd.write_string(tempString, font=font5x5, brightness=BRIGHTNESS) scrollphathd.show() # print(tempString) targetTime = time.time() + showTime while (time.time() < targetTime): time.sleep(0.05)
def on_message(client, userdara, msg): # dim the display before 7am and after 7pm brightness_modifier = 1 if 7 <= datetime.datetime.now( ).hour <= 19 else night_brightness_modifier if msg.topic == MQTT_TOPIC: global pos_x payload = json.loads(msg.payload) print payload["actual_temperature"] last_temperature_received = str(payload["actual_temperature"]) # display height is 7, save the bottom row for the graph scrollphathd.clear_rect(0, 0, None, 6) # None defaults to display size scrollphathd.write_string(last_temperature_received, brightness=0.5 * brightness_modifier, font=font3x5) scrollphathd.show() elif msg.topic == SERVER_LOAD_TOPIC: print msg.payload last_load_received = float(msg.payload) scrollphathd.clear_rect(0, 6, None, 1) # None defaults to disqlay size brightness = 0.5 if last_load_received > 8.0: brightness = 1 last_load_received = 8 load_bar_width = last_load_received / 8.0 * 17 scrollphathd.fill(brightness * brightness_modifier, int(17 - load_bar_width), 6, int(load_bar_width + 1), 1) scrollphathd.show()
def show_altitude(): # Makes sure scrollphat buffer is clear sphd.clear() # Altitude value is fetched from weather module altitudevalue = weather.altitude(qnh=1032) # If statement controls if speach output will say "below" or "above" sea level if (altitudevalue <= 0): sealevel = " meters below sea level" elif (altitudevalue >= 1): sealevel = " meters above sea level" # Uses say_value() to speak the current atititude speakaltitude = ("You are roughly " + str(int(altitudevalue)) + sealevel) print(speakaltitude) say_value(x=speakaltitude) # Writes the current sphd.write_string("Altitude: " + str(int(altitudevalue)) + "m", brightness=0.25) # Length of buffer is calculated length = sphd.get_buffer_shape()[0] - 17 # Scrolls for the total length value for x in range(length): sphd.show() sphd.scroll(1) time.sleep(0.03) # Sleeps for 1 second once complete time.sleep(1) # Clears buffer and runs show() to clear display sphd.clear() sphd.show() # Makes sure all button LED's are turned off touchphat.all_off()
def showSecondsOnScrollPhatHD(seconds): scrollphathd.clear() float_sec = (seconds % 60) / 59.0 seconds_progress = float_sec * 15 if DISPLAY_BAR: for y in range(15): current_pixel = min(seconds_progress, 1) scrollphathd.set_pixel(y + 1, 6, current_pixel * BRIGHTNESS) seconds_progress -= 1 if seconds_progress <= 0: break else: scrollphathd.set_pixel(int(seconds_progress), 6, BRIGHTNESS) hours = str(int(seconds) / 60 / 60).zfill(2) minutes = str(int(seconds) / 60 % 60).zfill(2) scrollphathd.write_string( hours + ":" + minutes, x=0, # Align to the left of the buffer y=0, # Align to the top of the buffer font=font5x5, # Use the font5x5 font we imported above brightness=BRIGHTNESS # Use our global brightness value ) if int(seconds) % 2 == 0: scrollphathd.clear_rect(8, 0, 1, 5) scrollphathd.show()
def weather(): scrollphathd.clear() (resp_headers, content) = h.request("http://api.openweathermap.org/data/2.5/weather?id=" + CITY_ID + "&appid=" + OPENWEATHER_APIKEY + "&units=" + UNITS, "GET", headers={'cache-control':'max-age=' + CACHE_TIME}) data = json.loads(content.decode('utf-8')) t = str(data['main']['temp']) con = data['weather'][0]['main'] tt = float(t) if UNITS == "imperial" : TF = "F" else : TF = "C" string = " %.1f" % tt + TF + " - " + con + " - " strlen = len(string) nummax = strlen + 26 numtimes = nummax*2 while True: scrollphathd.write_string(string, x=0, y=1, font=font3x5, letter_spacing=1, brightness=BRIGHTNESS) scrollphathd.show() scrollphathd.scroll() time.sleep(0.08) global num num += 1 if num == numtimes: num = 0 break
def exp_trg(): global trg_x, trg_y, blt_x, blt_y x = blt_x + 1 y = blt_y hide_trg() hide_blt() draw_pixel(x, y, bright0) blt_x = blt_x + 1 draw_pixel(x, y - 1, bright3) draw_pixel(x, y + 1, bright3) draw_pixel(x - 1, y, bright3) draw_pixel(x + 1, y, bright3) draw_pixel(x - 1, y - 1, bright1) draw_pixel(x + 1, y - 1, bright1) draw_pixel(x - 1, y + 1, bright1) draw_pixel(x + 1, y + 1, bright1) scr.show() time.sleep(delay) draw_pixel(x, y - 1, bright0) draw_pixel(x, y + 1, bright0) draw_pixel(x - 1, y, bright0) draw_pixel(x + 1, y, bright0) draw_pixel(x - 1, y - 1, bright0) draw_pixel(x + 1, y - 1, bright0) draw_pixel(x - 1, y + 1, bright0) draw_pixel(x + 1, y + 1, bright0) hide_blt()
def flashOn(): # # Set the Blinkt LED's to all white # blinkt.set_all(255, 255, 255, 0.3) # Set the Blinkt LED's all on and white blinkt.show() clearScrollPhatHD() # Clear the Display # # Show a bright rectangle as a flash # for i in range(0, 17): # loop through the numbers 0 to 10 scrollphathd.set_pixel(i, 0, 1) # set the pixel on the row for i in range(0, 7): # loop through the numbers 0 to 10 scrollphathd.set_pixel(0, i, 1) # set the pixel on the row for i in range(0, 17): # loop through the numbers 0 to 10 scrollphathd.set_pixel(i, 6, 1) # set the pixel on the row for i in range(0, 7): # loop through the numbers 0 to 10 scrollphathd.set_pixel(16, i, 1) # set the pixel on the row scrollphathd.show()
def run(self, textToScroll): self._running = True print("Starting to Scroll: " + textToScroll) print(textToScroll) setScrollPhatHDText(textToScroll, 0) # # Scroll the Message Forever across the display # while True: if self._running == False: print("Exitting Scroll Forever") clearScrollPhatHD() # Clear the Display break try: scrollphathd.scroll(1) # Scroll the Display by 1 scrollphathd.show() # Show the newly Scrolled DIsplay sleep(0.05) # Delay by 500ms except KeyboardInterrupt: clearScrollPhatHD() # Clear the Display sys.exit(-1) # Exit the Routine break
def clearArea(): if request.is_json: schema = td["actions"]["clearRect"]["input"] valid_input = Draft6Validator(schema).is_valid(request.json) if valid_input: x = 0 y = 0 w = 17 h = 6 try: x = int(request.json["x"]) except Exception as e: print(e) try: y = int(request.json["y"]) except Exception as e: print(e) try: w = request.json["width"] except Exception as e: print(e) try: h = request.json["height"] except Exception as e: print(e) scrollphathd.clear_rect(x, y, w, h) scrollphathd.show() return "", 204 else: abort(400) print("wrong input") else: abort(415) # Wrong media type.
def _dequeue(): global status_length scrollphathd.clear() logger.info("len(q) = {}".format(len(q))) status = q.pop() status_length = scrollphathd.write_string(status, x=18, y=0, font=font5x7smoothed, brightness=0.4) + 17 scrollphathd.show() time.sleep(0.01)
def lights(): if not _scroll_finished(): _scroll() elif _scroll_finished() and any(q): _dequeue() else: scrollphathd.clear() scrollphathd.show() time.sleep(0.25)
def close(): scrollphathd.clear() scrollphathd.show()
import time from scrollphathd.fonts import font5x7smoothed from twitterpibot.responses.Response import _one_in logger = logging.getLogger(__name__) scroll_until_x = 0 q = [ "Hello World" ] status_length = 0 scrollphathd.rotate(degrees=180) scrollphathd.clear() scrollphathd.show() def jump_queue(text): logger.info("_enqueue text = {}".format(text)) q.append(text) def enqueue(text): logger.info("_enqueue text = {}".format(text)) q.insert(0, text) def _dequeue(): global status_length scrollphathd.clear()
def _scroll(): global status_length scrollphathd.scroll(1) status_length -= 1 scrollphathd.show() time.sleep(0.01)