Skip to content

Instantly share code, notes, and snippets.

View BrianAdams's full-sized avatar

badevguru BrianAdams

  • Bay Area, CA
View GitHub Profile
@BrianAdams
BrianAdams / firmware-upload.sh
Created March 16, 2013 02:56
This potentially will fix the issue with Arduino programming of firmware not happening reliably for the OpenROV project.
#!/bin/sh
PROGNAME=$(basename $0)
error_exit ()
{
# ----------------------------------------------------------------
# Function for exit due to fatal program error
info: Welcome to Nodejitsu badevguru
info: jitsu v0.12.10-2, node v0.10.4
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in src/app.js
warn: Local package version appears to be old
warn: The package.json version will be incremented automatically
warn: About to write /Users/brian/Projects/openrov-software/package.json
data:
data: {
@BrianAdams
BrianAdams / keypad.js
Last active December 17, 2015 00:09
From: src/static/js/keypad.js Line 35-53 are the power settings in percent power based on the key pressed. If you change line 37 from .1 to .05 that would mean the 1-key would adjust the power down to 5%. At the low power settings, the calibration of the ESC become more important. We may also need to add code to actually add more power at first …
var KEYS = {
32: { // space (all-stop)
command: 'stop'
},
38: { // up (forward)
command: 'command',
position: 'throttle',
value: 1
},
40: { // down (aft)
@BrianAdams
BrianAdams / gamepad.js
Created May 4, 2013 18:24
I've modified this to make smaller increments in the gamepad for power. It was 20% as the lowest (while the keypad supported 10%). The change I have made on line 46 and 47 set it at 10% like the keypad. I've also lowered the default powerlevel from .4 (40%) to .2 (20%).
//http://www.html5rocks.com/en/tutorials/doodles/gamepad/gamepad-tester/tester.html
//useful for testing the buttons and finding the numbers
//
//Requires the https://github.com/kallaspriit/HTML5-JavaScript-Gamepad-Controller-Library
//library.
var GamePad = function() {
var gamepad = new Gamepad();
var gp = {};
var padStatus = {
@BrianAdams
BrianAdams / app.js
Last active August 29, 2015 14:01
Example code for pebblecloud simply.js integration with socket.io and OpenROV
simply.text({
title: 'Rov Demo!',
body: 'loading'
});
//Replace code with the IP address of the ROV as seen by your phone
var io = simply.loadScript('http://192.168.156.202:8080/socket.io/socket.io.js', false);
var socket = io.connect('http://192.168.156.202:8080');
socket.on('status', simply.wrapHandler(function (data) {
#include <AltSoftSerial.h> //Include the software serial library
#include <Wire.h>
const byte i2c_address=0x77;
AltSoftSerial altSerial; //Name the software serial library altSerial (this cannot be omitted)
int s0 = 7; //Arduino pin 7 to control pin S0
int s1 = 6; //Arduino pin 6 to control pin S1
char sensordata[30]; //A 30 byte character array to hold incoming data from the sensors
@BrianAdams
BrianAdams / mjepg_bandwidth.patch
Last active June 25, 2021 20:37
v4l2 driver patch
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 7c8322d..f389ccb 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -36,6 +36,7 @@ unsigned int uvc_no_drop_param;
static unsigned int uvc_quirks_param = -1;
unsigned int uvc_trace_param;
unsigned int uvc_timeout_param = UVC_CTRL_STREAMING_TIMEOUT;
+unsigned int uvc_jpeg_comp_param;
@BrianAdams
BrianAdams / tester-bonescript.js
Last active August 29, 2015 14:08
Initial test code for a bed of nails tester for the OpenROV controller board
var jsm = require('javascript-state-machine');
var b = require('bonescript');
var proc = require('child_process');
var spawn = proc.spawn;
var Q = require('q');
var serialPort = require('serialport');
var testnumberInProgress = 0;
// Pin Mappings, names match the schematic
/* Self-Test Code for OpenROV Controller Board 2.5
Initial Version 6 September 2013 W. Holm
*/
#include <Wire.h>
/* The following declarations are used for the I2C A/D converter on the test jig
set -e
apt-get update -qq
apt-get -y install python-software-properties
add-apt-repository ppa:webupd8team/java
apt-get update -qq
curl -sL https://deb.nodesource.com/setup | sudo bash -
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8