![]()
Desktop cryptocurrency ticker full#(the command "mylcd.lcd_display_string" need the line parameter) Like : mylcd.lcd_display_string(("%s" %time.strftime("%H:%M ")) + ("%s" %time.strftime("%m/%d/%y")), 2) for line 2 Attention : Connect SDA to SDA GPIO 8 or GPIO 9 IS WRONG !! Correct wiring : GPIO 2 to SDA and GPIO 3 to SCL Full working python Script : # Created by reddit user anonananananabatman # Made available under GNU GENERAL PRIVATE LICENSE # ver 1.0 import time import json import requests import I2C_LCD_driver mylcd = I2C_LCD_driver.lcd() mylcd.lcd_clear() # Display loading string mylcd.lcd_display_string("Working.",1) # Create font for arrows fontdata1 =, ,, ] # import font data mylcd.lcd_load_custom_chars(fontdata1) # set variables for last price of currency lastPrice = 0 lastPrice1 = 0 lastPrice2 = 0 lastPrice3 = 0 # Preload btc price before beginning while loop def btcPrice(): try: b = requests.get(' ') priceFloat = float(json.loads(b.text)) return priceFloat except requests.ConnectionError: print ("Error querying Crytocompare API") # Determines direction of the arrow def arrow_dir(): currentPrice = btcPrice() if lastPrice = currentPrice: return 2 elif lastPrice > currentPrice: return 1 elif lastPrice currentPrice1: return 1 elif lastPrice1 currentPrice2: return 1 elif lastPrice2 currentPrice3: return 1 elif lastPrice3 currentPrice: return 1 elif lastPrice < currentPrice: return 0 time.Cryptocurrency works through networks of nodes that are constantly communicating with each other to stay updated about the current state of the ledger. Lastly, place the pi inside the case, cover with the cap, and plug it in!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |