This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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(){ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
OlderNewer