Skip to content

Instantly share code, notes, and snippets.

View rjehangir's full-sized avatar

Rustom Jehangir rjehangir

View GitHub Profile
@rjehangir
rjehangir / gist:00ab863d6e9d9899873cdcc399694510
Created November 22, 2019 14:09
Woo-CP-Javascript-Data-Example
/**
* Triggers an action when the total price of a composite product changes
*
*/
;( function ( $, window, document, undefined ) {
$( '.composite_data' )
.on( 'wc-composite-initializing', function( event, composite ) {
var obj = composite.api;
#define DEADBAND 25
int rawJS1 = analogRead(JS_ADC_1);
if (rawJS1 > JS_CENTER_1 && rawJS1 < JS_CENTER_1 + DEADBAND) {
rawJS1 = JS_CENTER_1;
}
if (rawJS1 < JS_CENTER_1 && rawJS1 > JS_CENTER_1 - DEADBAND) {
rawJS1 = JS_CENTER_1;
@rjehangir
rjehangir / iperf3-usage.md
Last active March 7, 2019 16:09
Commands for Bandwidth Testing Using iperf3

iperf3 Usage for Bandwidth Testing

We use this command to test bandwidth and packet loss versus tether length with the Fathom-X tether interface boards.

Server (i.e. Raspberry Pi)

The IP address in this command should be the IP address of the server.

#!/usr/bin/python
from pymavlink import mavutil
from pymavlink.dialects.v10 import common as mavlink
# UDP settings (must match a udpout port running on mavproxy)
address = 'localhost'
port = 9001
#master = mavutil.mavlink_connection(args.device, baud=args.baudrate, source_system=args.SOURCE_SYSTEM)
# Companion Computer Scripts
# Add these two lines to /etc/rc.local
screen -dm -S mavproxy /home/pi/companion/RPI2/Raspbian/start_mavproxy_telem_splitter.sh
screen -dm -S video /home/pi/companion/RPI2/Raspbian/start_video.sh
/* Blue Robotics Example Code
-------------------------------
Title: Multiple ESC Control via I2C (Arduino)
Description: This example code demonstrates the I2C communication capability
of the Blue Robotics "BlueESC". Motor speed commands are sent via I2C and
voltage, current, rpm, and temperature data is returned.
The code is designed for the Arduino Uno board and can be compiled and
uploaded via the Arduino 1.0+ software.
-------------------------------
@rjehangir
rjehangir / examplePWM.py
Last active August 29, 2015 14:26
Python code for T100/T200 Thrusters using Adafruit PWM Shield
#!/usr/bin/python
# Testing T200 thruster activation
from Adafruit_PWM_Servo_Driver import PWM
import time
# Initialize the PWM device using the default address
pwm = PWM(0x40)
frequency = 100