Skip to content

Instantly share code, notes, and snippets.

View carneeki's full-sized avatar

Adam carneeki

View GitHub Profile
@carneeki
carneeki / TEAM-4774-JAVATUT-002-LoopFor.java
Last active December 10, 2015 09:09
Demonstrate loops using for() syntax
class LoopFor
{
public static void main (String[] args)
{
for(int i=1; i<=10; i++) // here we create our counter, then set the condition,
// and finally increment the counter all in one line
{
System.out.println(i); // this is where we do our stuff
}
}
@carneeki
carneeki / TEAM-4774-JAVATUT-000-HelloWorld.java
Last active December 10, 2015 09:09
HelloWorld - the classic first program to write.
class HelloWorld
{
public static void main (String[] args)
{
System.out.println("Hello World!");
}
}
@carneeki
carneeki / Tachometer.java
Created February 2, 2013 20:27
possible tachometer for plugging in to PIDController / PIDSubsystem
package first.frc.landownunder.components;
import edu.wpi.first.wpilibj.Counter;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.PIDSource;
/**
* A tachometer using DigitalInput high pulses.
* @author carneeki
* @since 2012-02-03 05:05AEDT

Keybase proof

I hereby claim:

  • I am carneeki on github.
  • I am carneeki (https://keybase.io/carneeki) on keybase.
  • I have a public key whose fingerprint is D7D0 B442 AA63 ECBC F940 44DD 0156 19DB FBFE F9A8

To claim this, I am signing this object:

@carneeki
carneeki / AutoTest.ino
Created March 14, 2016 10:26
Autonomous Board Test for Team 4802 in FRC game 2016
/*
* Autonomous Board Test
*
* Test an individual switch for Autonomous on the RoboRIO for BGHS/4802 in the
* 2016 FRC game.
*/
void setup()
{
// send serial to the PC
import java.util.ArrayList;
public class FSM
{
public class State
{
final boolean acceptor;
private final int num;
final int r0; // what to return if given zero
final int r1; // what to return if given one
@carneeki
carneeki / RGBFlash.ino
Created August 24, 2016 04:32
flash red -> green -> blue
// RGB flasher for Darius :D
int red = 3;
int blu = 5;
int grn = 9;
void setup() {
pinMode(red, OUTPUT);
pinMode(grn, OUTPUT);
pinMode(blu, OUTPUT);
digitalWrite(red, LOW);
@carneeki
carneeki / Kiwi.java
Created January 28, 2017 07:47
possible KiwiDrive example code for 4802
public class Kiwi
{
SafePWM s1 = new SafePWM(0); // motor 1 pwm port 0
SafePWM s2 = new SafePWM(1); // motor 2
SafePWM s3 = new SafePWM(2); // motor 3
private final double[][] inversion = { {2/3, 0, 1/3}, {-1/3, 1/sqrt(3), 1/3}, {-1/3, -1/sqrt(3), 1/3}};
public Kiwi()
{
@carneeki
carneeki / .bashrc
Created January 31, 2017 02:45
bashrc for weather updates with wttr.in
# Add a function to get weather refreshed every ten minutes to terminal
# using wttr.in. Can be used as follows:
# wttr Arlen # Fictional town in Texas
# wttr KSGF # ICAO code for Springfield, Missouri
# wttr # Use a default location in code below
#
# See wttr.in/:help for more details
wttr()
{
tmpfile=$(mktemp /tmp/wttr.XXXXXX)
@carneeki
carneeki / kiwiTest.c
Created January 31, 2017 03:49
Test of Kiwi Drive
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*
* Simple C program to give test parameters for Kiwi Drive robot: x, y, p
* Two joysticks required:
* one provides vector of robot direction ('x' + 'y' components),
* the other provides pivot component (one axis only, called 'p')
* Values are input on command line as space separated values: x y p