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
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
void ISR THINGY JacobIsCool(void) { | |
//Turn on all 4 lights | |
// wait a second | |
//Clear flag | |
} | |
main(){ | |
//Set LED Pins to OUTPUT | |
//Set the interrupt pin to input | |
/* Tell controller Interrupts can happen */ |
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
void __ISR(3) JacobIsCool_Int1(void){ | |
//Read in values | |
//A rising edge | |
//CW 1 to 2 | |
//CCW 4 to 3 | |
//A falling edge | |
//CCW 2 to 1 | |
//CW 3 to 4 | |
//Keep count between 0 and 15 | |
//Write to LEDs |
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 |
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
/* | |
* 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> | |
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
// WORKING VERSION WITH RENARD PROTOCOL USING SERIAL3 (PINS 14 TO FTDI RX AND 15 TO FTDI TX) | |
// This code was written by Victor Perez for doityourselfchristmas.com based on the code from Zparticle, Si_champion and Neil Tapp. | |
// To adapt the code to your case, just change this top section, with the #define lines. | |
// Includes the watchdog timer library | |
#include <avr/wdt.h> | |
// KG add for renard. Include the Arduino Renard library by Bill Porter | |
#include <Arduino-Renard.h> |
OlderNewer