Toggle Navigation
Hatchery
Eggs
BTC Price Checker
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
import uinterface, rgb, time, default_icons, urequests rgb.clear() api = 'https://www.bitstamp.net/api/v2/ticker/btcusd' uinterface.connect_wifi() data, size, frames = default_icons.animation_loading rgb.gif(data, (13, 1), size, frames) while True: request = urequests.get(api) result = request.json() last = float(result['last']) open = float(result['open']) percent = ((last-open)/open)*100 rgb.clear() if last > open: rgb.text(str(last), (0,255,0)) time.sleep(2) rgb.clear() rgb.text("+" + str(percent), (0, 255, 0)) time.sleep(2) rgb.clear() rgb.text(str(last), (0, 255, 0)) time.sleep(2) else: rgb.text(str(last), (255,0,0)) time.sleep(2) rgb.clear() rgb.text(str(percent), (255, 0, 0)) rgb.clear() rgb.text(str(last), (255, 0, 0)) time.sleep(2) time.sleep(30)