Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Seth
Published

Dweet.io and the BBBW

Did you want to see different aspects in a visual manner w/out Matplotlib or Numpy on ARM devices?

BeginnerProtip1 hour839
Dweet.io and the BBBW

Things used in this project

Hardware components

BeagleBone Black Wireless
BeagleBoard.org BeagleBone Black Wireless
×1

Software apps and online services

Dweet.io
Python3

Story

Read more

Schematics

BBBW

Use the power of Linux! Oh and Python3!

Code

UUID and Dweet.io

Python
You might need to install requests and psutil.
import requests, psutil, os

import time
import datetime

thing_name = "UUID"

def dweet(thing, **vals):
    url = "http://dweet.io/dweet/for/{}".format(thing)
    requests.post(url, params=vals)

def get_uptime():
    with open("/proc/uptime", "r") as f:
        raw = f.read()
    seconds = float(raw.split()[0])
    return seconds

while True:
    uptime = get_uptime()
    uptime_datetime = datetime.datetime.fromtimestamp(uptime)
    uptime_datetime.strftime("%H:$M:$S")

    load = psutil.cpu_percent(interval=2)
    mem = psutil.virtual_memory()[2]

    dweet(thing_name, uptime=uptime, cpu_load=load, memory=mem)

Credits

Seth

Seth

32 projects • 13 followers
Stay there and someone will find you...
Thanks to #beagle at Freenode and Some book in time...I cannot remember and I cannot find the book to share attribution right now. .

Comments