Skip to content

Instantly share code, notes, and snippets.

View ricklon's full-sized avatar

Rick Anderson ricklon

View GitHub Profile
@ricklon
ricklon / gist:57abffa67103b0c1d0a5
Created May 8, 2014 23:08
Test Code for FubarStep scanning project
#include <SoftPWMServo.h>
const int moveButtonPin = 0;
const int scanSwitchPin = 2;
int pos = 1000; // variable to store the servo position, in microseconds
// For Fubarino SD
#if defined(_BOARD_FUBARINO_SD_)
#define M1EN12 7
//************************************************************************
// pic32_cdcacm.c
//
// this file implements a CDC/ACM transport on top of the usb driver module.
//
// This file originated from the cpustick.com skeleton project from
// http://www.cpustick.com/downloads.htm and was originally written
// by Rich Testardi; please preserve this reference and share bug
// fixes with rich@testardi.com.
//************************************************************************
@ricklon
ricklon / gist:b1a28db2b7d70cd14e76
Created July 30, 2015 14:20
My Arduino Default Serial Code: My boards are starting immediately before I can see the set up data. This causes it to wait for the user.
/*
Fubarino Test Serial
This works for SD and Mini.
Wait for start char 's' then go into echo mode:
What ever is typed is passed from one interface to the other
until the result is printed in terminal.
*/
char cc;
char cc0;
rx |
tx |
wake_sw |
wake_hw |
cmd_mldp //command vs data? |
//optional
@ricklon
ricklon / gist:b62c998dfd06426e78a5
Created October 10, 2015 19:58
Create USB image for Ubuntu or other distros
# convert the iamge
hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso
# find the usb flash drive
diskutil list
# unmount the drive
diskutil unmountDisk /dev/diskN
# write the image
sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m
# eject and remount drive
diskutil eject /dev/diskN
@ricklon
ricklon / gist:f62f4e3370e75ee79470
Last active October 27, 2015 03:01
sox, play for sound for PWMAudio, wav2c
sox sine.wav --bits 16 -r 11025 --encoding signed-integer sine.raw
play -r 11025 -b 16 -e signed-integer sine.raw
#Then use wav2c to encode the sine.raw file. Then change the variable to match
#https://github.com/olleolleolle/wav2c
~/apps/wav2c/wav2c sine.wav sine.h soundata
@ricklon
ricklon / gist:5534622
Created May 7, 2013 17:50
Convert jp2 to png on the command line
mogrify -format png *.jp2
@ricklon
ricklon / gist:5545440
Created May 9, 2013 03:53
Blink Pin in Micros, n times.
void blink(int pin, int times, int delayMicros)
{
for (int ii = 0; ii < times; ii++)
{
digitalWrite(pin, HIGH);
delay(delayMicros);
digitalWrite(pin, LOW);
delay(delayMicros);
}
@ricklon
ricklon / gist:5896368
Created June 30, 2013 18:50
Create custom raspberry pi image from gzipped img file
http://minordiscoveries.wordpress.com/2013/03/30/backing-up-raspberry-pi-sd-card-on-mac-os-x/
create compressed backup
sudo dd if=/dev/rdisk1 bs=1m | gzip > /path/to/backup.gz
restore compressed backup
diskutil list
gzip -dc /path/to/backup.gz | sudo dd of=/dev/rdisk1 bs=1m
const int DIR1 = 4; //orange
const int PWM1 = 7;
const int DIR2 = 8; //brown
const int PWM2 = 9; //white
void setup() {
pinMode(DIR1, OUTPUT);
pinMode(PWM1, OUTPUT);