Skip to content

Instantly share code, notes, and snippets.

@jakabo27
jakabo27 / FiberOptic_ClemsonPic.ino
Created July 22, 2018 15:29
The Arduino code running 4 color modes on an Arduino UNO for some WS2812B LED strip lights using the FastLED library
#include <FastLED.h>
#include <LowPower.h>
#include <EEPROM.h>
//FastLED setup
#define NUM_LEDS 4
#define PIN 3 //Data pin for LED strip
CRGB leds[NUM_LEDS];
//Twinkle setup
@jakabo27
jakabo27 / PIC32JacobLibrary.c
Created September 12, 2018 23:14
A shortcut library for using the PIC32 microcontroller to make digital pin interfacing more user-friendly
//delay for a given number of milliseconds (approximated)
delay(int delayTime){
int i, j;
for(i = 0; i < delayTime; i++)
for(j = 0; j < 312; j++);
}
digitalWrite(int pin, bool pinState)
{
#include<plib.h>
int i;
//Interrupt Functions
void __ISR(3) ButtonInterrupt(void){
i = i+25;
if(i>100)
{//reset duty cycle
i = 0;}
OC1RS = i; //Cycle through duty cycle of 0%, 25%, 50%, 75%, 100%
IFS0bits.INT0IF = 0; // Clear Interrupt Flag
#!/bin/sh
###########################################################
#To be run if the button is pressed.
#You should have two playlists for each song - one with
# just the song as the "First play" and nothing in main,
# and another with the song as first play and your standby
# sequence as the "Main" sequence. (At least if you want
# to do the exact thing that I'm doing)
#
#include <plib.h>
#define maxRotaryNumber 9
#define maxLEDNum 8
//This is here to make timing calculations easier!
#pragma config FPBDIV = DIV_2
#define E 3031
#define F 2866
#define Fs 2703
#define Gb 2703
#include <plib.h>
void __ISR(3) function2(void){
//turn on indicator LED - useful to know when it should be communicating
for(m = 0; m < 150; m++) // delay for 150ms
for(j = 0; j < 312; j++);
//turn off indicator LED
//Pass data to SPI buffer
main(){
//Set up inputs and outputs
//Turn on comparators
// Set common comparator Voltages
//Set up each comparator CCH CREF CPOL
while(1)
{
//Write the outputs of the comparators to the output pins
}
#include<plib.h>
//Interrupt Function
{
//Send Data to LEDs uses 4 buffers to make it more exact
//shifts bits to only get upper bits
//Reset flag for interrupt
}
main(){
/*
* 0 = 0
* 1 = 25% forward
* 2 = 50% forward
* 3 = 75% forward
* 4 = 100% forward
* 5 = 0 back
* 6 = 25% back
* 7 = 50% back
* 8 = 75% back
#include <plib.h>
//This is here to make timing calculations easier!
#pragma config FPBDIV = DIV_2
//r is a Rest. The value doesn't matter, it just has to be unique (not another note)
#define r 3000
//I added another octave of notes that they didn't give us
//Cs = C sharp. Eb = E flat. Everything else is normal.
//lowest notes