Skip to content

Instantly share code, notes, and snippets.

View rhammell's full-sized avatar

Bob Hammell rhammell

View GitHub Profile
@rhammell
rhammell / code.py
Created March 15, 2024 17:23
CircuitPython script to display icons on TFT display
import time
import random
import board
import displayio
import fourwire
import adafruit_ili9341
import pwmio
# Create display
displayio.release_displays()
body {
color: #333;
font-family: "PT Sans", sans-serif;
}
#main {
width: 960px;
margin: 2em auto 4em auto;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Crypto Trades</title>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
import json
import time
import requests
from datetime import datetime
import RPi.GPIO as GPIO
class FlowMeter():
''' Class representing the flow meter sensor which handles input pulses
and calculates current flow rate (L/min) measurement

Making a Reddit Upvote Notifier

The Arduino Yún's ability to connect to the Internet introduces many new possibilities to traditional Arduino development, such as capturing data from the web and making use of it inside of a sketch.

This project will demonstrate this ability by monitoring the number of upvotes accrued by a Reddit comment thread and alerting the user when new upvotes are added.

Many companies offer application programming interfaces (APIs, for short) that allow third-party programs to access their data. Reddit, for example, provides an API that gives detailed information and statistics for posts, comment threads, and users.

This project uses a Python script on the Yun's Linux side to read the current upvote count from a comment thread using Reddit's API. A skech running on the Arduino side will track this number and display a notification message on an LED matrix every time a new vote is added.

@rhammell
rhammell / hourly.py
Created September 3, 2018 18:04
Get hourly candle data using GDAX API
''' Get historic crypto price data using the GDAX API '''
import time
import datetime
import json
import gdax
# Create gdax client
client = gdax.PublicClient()
label value1 value2
Label A 9661 502762091
Label B 10767 752485322
Label C 5698 500227050
Label D 7324 262195449
Label E 3885 102223166
Label F 2603 95522280
Label G 1149 20167556
Label H 1502 11810268
Label I 1079 23298055
date close
24-Apr-07 93.24
25-Apr-07 95.35
26-Apr-07 98.84
27-Apr-07 99.92
30-Apr-07 99.80
1-May-07 99.47
2-May-07 100.39
3-May-07 100.40
4-May-07 100.81
print("test")