Skip to content

Instantly share code, notes, and snippets.

Avatar

Jim Whitfield jimwhitfield

  • Silicon Valley, California
View GitHub Profile
@jimwhitfield
jimwhitfield / Node-Red RasPi linux dashboard
Last active Jan 10, 2020
Node-Red export of working dashboard for OPS24x on RasPi
View Node-Red RasPi linux dashboard
[
{
"id": "38ae5584.60dc7a",
"type": "tab",
"label": "OPS24--A",
"disabled": false,
"info": ""
},
{
"id": "f22dee6b.be4d4",
@jimwhitfield
jimwhitfield / NodeRed-raspi-OP24--A
Created Jan 8, 2020
NodeRed flow to use ttyACM0 and play a sound on data swing
View NodeRed-raspi-OP24--A
[
{
"id": "6bf977c3.4c5c68",
"type": "tab",
"label": "OPS24--A",
"disabled": false,
"info": ""
},
{
"id": "6b995d18.2cd584",
@jimwhitfield
jimwhitfield / RadarSensorLCD
Created Mar 7, 2019
Arduino code (beware..uses 'Serial1') for running the OmniPreSense RadarSensor on an LCD responding to a 9481 LCD driver
View RadarSensorLCD
#include <MCUFRIEND_kbv.h>
#include <Adafruit_GFX.h> // Core graphics library
// wiring with UNO or Mega2560:
//--------------POWER Pins--------------------------------
// 5V connects to DC 5V
// GND connects to Ground
// 3V3 do not need to connect(NC)
//--------------LCD Display Pins--------------------------
// LCD_RD connects to Analog pin A0
@jimwhitfield
jimwhitfield / verydumbterm.py
Last active Aug 24, 2018
python USB (/dev/ttyACM0) serial terminal that works over ssh. reads from stdin, mingles the echo with whatever arrives from serial
View verydumbterm.py
#!/usr/bin/env python3
import serial
from serial.serialutil import SerialException
import sys
import select
import tty
import termios
def key_available():
@jimwhitfield
jimwhitfield / print_json_posts.py
Last active Aug 9, 2018
Web server to accept JSON-formatted HTTP POSTs and pretty-print the payload
View print_json_posts.py
#!/usr/bin/python2
# Derived from https://gist.github.com/bradmontgomery/2219997#file-dummy-web-server-py-L26
# Added the feature to read the post body and print it to console.
# Not useful if the post body isn't json
# Usage::
# ./print_json_posts.py [<port>]
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import SocketServer
import json
View OmniPreSense-radar-Ubiquity-follow.py
#!/usr/bin/python
"""
Copyright (c) 2017, Ubiquity Robotics
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
View OPS241Radar.py
#!/usr/bin/env python3
# Import time, decimal, serial, GPIO, reg expr, sys, and pygame modules
import os
import sys
from time import *
from decimal import *
import serial
import re
import pygame
View Node-Red OPS241-basic-example.json
[
{
"id": "d2eb373.3f50cc8",
"type": "tab",
"label": "Flow 2"
},
{
"id": "92070e99.486ef",
"type": "serial in",
"z": "d2eb373.3f50cc8",
@jimwhitfield
jimwhitfield / PC-OPS241 NodeRed.json
Last active May 8, 2017
A Node Red flow for PC which reads from COM3 and plays the audio file (as coded) in the browser
View PC-OPS241 NodeRed.json
[
{
"id": "90b76976.49ff38",
"type": "tab",
"label": "Flow 1"
},
{
"id": "52bcfbfe.e89d74",
"type": "switch",
"z": "90b76976.49ff38",
@jimwhitfield
jimwhitfield / OPS241 NodeRed Flow
Created May 7, 2017
A NodeRed flow that reads from the OPS241 and plays a wav file if over the speed threshold
View OPS241 NodeRed Flow
[
{
"id": "8eb36c95.abf588",
"type": "exec",
"z": "bb84ba45.9732b8",
"command": "/usr/bin/aplay",
"addpay": false,
"append": "/home/pi/SlowDown1s.wav",
"useSpawn": "",
"timer": "",
You can’t perform that action at this time.