Skip to content

Instantly share code, notes, and snippets.

View ShawnHymel's full-sized avatar

Shawn Hymel ShawnHymel

View GitHub Profile
@ShawnHymel
ShawnHymel / one_channel_receiver.ino
Created August 17, 2017 16:15
One Channel RC Hobby Receiver
/**
* One Channel Receiver
* Author: Shawn Hymel (SparkFun Electronics)
* Date: Aug 17, 2017
*
* Connect a TB6612FNG and RC (PWM) receiver to the Arduino.
* Only works 1 channel for forward and back drive.
*
* This code is beerware; if you see me (or any other SparkFun
* employee) at the local, and you've found our code helpful,
@ShawnHymel
ShawnHymel / Combat_Test_01.ino
Created August 15, 2017 03:37
Combat Bot Test 01
const int STBY_PIN = 9;
const int AIN1_PIN = 2;
const int AIN2_PIN = 4;
const int APWM_PIN = 5;
const int BIN1_PIN = 7;
const int BIN2_PIN = 8;
const int BPWM_PIN = 6;
void setup() {
@ShawnHymel
ShawnHymel / digital_compass.ino
Created August 4, 2017 15:18
Digital Compass
/**
* Digital Compass
* MAG3110 Demo
*
* Author: Shawn Hymel (SparkFun Electronics)
* Based on SparkFun_MAG3110_Calibrated.ino by George B.
* Date: July 25, 2017
*
* Connect MAG3110 to MicroView. If "Calibrating" appears,
* slowly rotate the MAG3110 sensor 360 degrees while flat on
@ShawnHymel
ShawnHymel / gps_parse.ino
Created July 26, 2017 22:37
Parsed GPS NMEA data
#include <SoftwareSerial.h>
SoftwareSerial soft(10, 11); // Rx, Tx
// Globals
String utc = ""; // hhmmss.00
String lat = ""; // DDMM.MMMM N/S
String lon = ""; // DDMM.MMMM E/W
String alt = ""; // x meters
@ShawnHymel
ShawnHymel / gps_raw.ino
Created July 26, 2017 22:36
GPS Raw NMEA
#include <SoftwareSerial.h>
SoftwareSerial soft(10, 11); // Rx, Tx
void setup() {
Serial.begin(9600);
soft.begin(9600);
}
void loop() {
@ShawnHymel
ShawnHymel / fred_bot.ino
Last active May 26, 2025 20:15
Use two magnetic encoders to make a robot drive in a straight line for 1 meter
/**
* Adventures in Science: Fred Bot
* SparkFun Electronics
* Author: M. Hord (October 8, 2013)
* Modified by: B. Huang (October 31, 2014)
* Modified by: Shawn Hymel (July 21, 2017)
*
* Use two magnetic encoders on Fred's motor shafts (48:1
* gearbox, 60mm wheels) to make him move in a straight line for
* 1m.
@ShawnHymel
ShawnHymel / quadrature_encoder_demo.ino
Created July 20, 2017 20:41
Quadrature Encoder Demo
// Parameters
const int threshold = 600;
const float multiplier = 1.4;
// Pins
const int i_pin = A1;
const int q_pin = A0;
const int led_pin = 8;
const int lamp_pin = 9;
@ShawnHymel
ShawnHymel / Roshamglo_Test_02.ino
Last active December 8, 2016 23:32
Roshamglo Test - hardware PWM with TOV interrupts. Now it works.
// Set this to enable serial debugging
#define debug 1
// Only include SofwareSerial if we're debugging!
#if (debug > 0)
# include <SoftwareSerial.h>
#endif
#if (debug > 0)
SoftwareSerial softy(2, 1); // RX, TX
@ShawnHymel
ShawnHymel / digital_picture_frame.ino
Last active December 5, 2016 22:04
Digital Picture Frame for Qduino (Arduino)
/**
* Qduino Picture Frame
* Author: Shawn Hymel
* Date: December 5, 2016
*
* Digital picture frame based on the Qduino Mini and Adafruit
* 2.2" LCD. Load microSD card with bitmap images with 240x320
* resolution. Name them sequentially:
* 00.bmp
* 01.bmp
@ShawnHymel
ShawnHymel / usno_get.ino
Created September 15, 2016 16:01
USNO API Example
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
// WiFi information
const char WIFI_SSID[] = "AP SSID";
const char WIFI_PSK[] = "AP PASSWORD";
// Remote site information
const char http_site[] = "api.usno.navy.mil";
const int http_port = 80;