Skip to content

Instantly share code, notes, and snippets.

View joelsimonoff's full-sized avatar

Joel Simonoff joelsimonoff

View GitHub Profile
@joelsimonoff
joelsimonoff / rgb.go
Last active April 25, 2017 04:38
Code that solves the problem of organizing an array (I used a golang slice) with a random distribution of red, green and blue values, into red values followed by blue values followed by green values, in O(n) time.
//
// Written By Joel Simonoff
// April 24, 2017
//
package main
import (
"fmt"
"math/rand"
//
// General
//
#define NUM_RELAYS 4
typedef enum {OFF, ON} State;
State relayStates[NUM_RELAYS] = {OFF, OFF, OFF, OFF};
//
//
// Pins Defined
//
#define RDY_0 2
#define REQUEST_0 3
#define SS_0 5
#define RDY_1 6
#define REQUEST_1 9
#define SS_1 10
#define RDY_2 11