Skip to content

Instantly share code, notes, and snippets.

Seth Battis battis

Block or report user

Report or block battis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@battis
battis / stepper_control.ino
Last active Apr 3, 2020
Using Arduino Stepper library to control 28BYJ-48 stepper motor with L293D H-bridge
View stepper_control.ino
/*
* Example code for controlling a 28BYJ-48 stepper motor through an L293D H-Bridge
*/
// Include the Arduino Stepper.h library
#include <Stepper.h>
/*
* Motor outputs from the 28BYj-48:
* 1 - blue ------|
@battis
battis / PrettySimpleAutonomous.java
Last active Apr 2, 2020
More elegant, less repetitious, more expandable/configurable simple autonomous
View PrettySimpleAutonomous.java
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
@Autonomous
public class PrettySimpleAutonomous extends LinearOpMode {
private DcMotor[] motors;
@battis
battis / SimpleAutonomous.java
Last active Apr 2, 2020
Simple Encoder Autonomous
View SimpleAutonomous.java
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
@Autonomous
public class SimpleAutonomous extends LinearOpMode {
@Override
public void runOpMode() throws InterruptedException {
@battis
battis / EncodedTankDrive.java
Created Apr 2, 2020
Enable encoder-supplemented consistency in Tank Drive
View EncodedTankDrive.java
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
@TeleOp
public class EncodedTankDrive extends OpMode {
@battis
battis / MyFirstOpMode.java
Created Mar 27, 2020
A basic tank drive OpMode
View MyFirstOpMode.java
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
@TeleOp
public class MyFirstOpMode extends OpMode {
View Simple H-Bridge Control.ino
const int ENABLE_A = 4;
const int ENABLE_B = 5;
const int SPEED = 6;
void setup() {
pinMode(ENABLE_A, OUTPUT);
pinMode(ENABLE_B, OUTPUT);
pinMode(SPEED, OUTPUT);
}
@battis
battis / DoublyIndexedList.java
Created Mar 23, 2020
Rethinking Levels as a doubly-indexed list
View DoublyIndexedList.java
import java.util.ArrayList;
import java.util.List;
public class DoublyIndexedList {
private Sprite[][] level;
/* ... */
public void set(int x, int y, Sprite sprite) {
level[x][y] = sprite;
@battis
battis / Current First Play Track.png
Last active Apr 23, 2019
Exploit iOS autoplay-on-connect bug for greater joy
@battis
battis / MecanumDrive.java
Created Jan 7, 2019
FTC MecanumDrive OpMode
View MecanumDrive.java
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
/**
* This is based on the helpful write-up at
* https://www.roboteq.com/index.php/component/easyblog/entry/driving-mecanum-wheels-omnidirectional-robots?Itemid=1208
* which itself is pulled from the Simplistic Control of Mecanum Drive from Ian McInerney, FRC Team 2022:
View musical_stairs.ino
/*
* Musical Stairs
*
* The core assumptions of this code mostly have to do with the sequence in which the
* XSHUT pins are wired together:
*
* 1. All of the XSHUT pins are contiguous on the Arduino, starting at XSHUT_OFFSET.
* 2. The pins are ordered L1, R1, L2, R2, ... , L10, R10
*
* At the moment, we are triggering a note to be played if REQ_CONSECUTIVE_BREAKS consecutive
You can’t perform that action at this time.