This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gpiozero import LED | |
from time import sleep | |
step = LED(4) | |
dir = LED(3) | |
step = LED(17) | |
dir = LED(18) | |
wait = 0.000051 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
#Installing v4l-utils (debian) gives one the handy v4l2-ctl command: | |
$ v4l2-ctl --list-devices | |
HPigh Definition Webcam (usb-0000:00:14.0-11): | |
/dev/video2 | |
UVC Camera (046d:0821) (usb-0000:00:14.0-13): | |
/dev/video0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2018/12/06 20:40:09 - $0=10 (step pulse, usec) | |
2018/12/06 20:40:09 - $1=25 (step idle delay, msec) | |
2018/12/06 20:40:09 - $2=0 (step port invert mask:00000000) | |
2018/12/06 20:40:09 - $3=5 (dir port invert mask:00000101) | |
2018/12/06 20:40:09 - $4=0 (step enable invert, bool) | |
2018/12/06 20:40:09 - $5=0 (limit pins invert, bool) | |
2018/12/06 20:40:09 - $6=0 (probe pin invert, bool) | |
2018/12/06 20:40:09 - $10=3 (status report mask:00000011) | |
2018/12/06 20:40:09 - $11=0.020 (junction deviation, mm) | |
2018/12/06 20:40:09 - $12=0.002 (arc tolerance, mm) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use shift registers(74HC595) to control an insane amount of digital inputs. | |
// https://www.youtube.com/watch?v=nXl4fb_LbcI | |
#include <SPI.h> | |
byte Input, Output, Check=1; | |
int j; | |
void setup(){ | |
pinMode(13, OUTPUT);//clock | |
pinMode(11, OUTPUT);//data | |
pinMode(4, OUTPUT);//latch | |
pinMode(2, INPUT);//Input from buttons |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// | |
double distance_on_geoid(double lat1, double lon1, double lat2, double lon2) { | |
// Convert degrees to radians | |
lat1 = lat1 * M_PI / 180.0; | |
lon1 = lon1 * M_PI / 180.0; | |
lat2 = lat2 * M_PI / 180.0; | |
lon2 = lon2 * M_PI / 180.0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Retrieve AWS instrance's commonly used metadata. Require curl. | |
# ./get-metadata help | |
# ./get-metadata id | |
# Input is case insensitive; format to uppper case to generate self-help page. | |
info=${1^^} | |
meta_data_url=http://169.254.169.254/latest/meta-data/ | |
roleProfile=$(curl -s http://169.254.169.254/latest/meta-data/iam/info \ | |
| grep -Eo 'instance-profile/([a-zA-Z.-]+)' | sed 's#instance-profile/##') |
NewerOlder