This commit is contained in:
gauthiier 2018-12-01 13:03:45 +01:00
parent c142b5b200
commit 7423e4c41b
3 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,33 @@
#define MIDI_CHANNEL 1
#include <spi4teensy3.h>
#include <EEPROM.h>
#include <Haarnet.h>
void setup() {
// We initialise the sound engine by calling Music.init() which outputs a tone
Music.init();
// Music.enableEnvelope1();
// Music.enableEnvelope2();
// These guys just have to be here...
usbMIDI.setHandleNoteOff(OnNoteOff);
usbMIDI.setHandleNoteOn(OnNoteOn);
usbMIDI.setHandleControlChange(OnControlChange);
// Loading a preset from EEPROM
Music.getPreset(16);
// Uncomment below if you want another midi note
// Music.noteOn(48,127);
}
void loop() {
// Checking for incoming MIDI to use dashboard
usbMIDI.read();
}

View File

@ -0,0 +1,59 @@
#define MIDI_CHANNEL 1
#include <Wire.h>
#include <Adafruit_TCS34725.h>
#include <spi4teensy3.h>
#include <EEPROM.h>
#include <Haarnet.h>
// sequence ID
int s1;
// sequence step index
int indx1 = 0;
const int nbr_notes = 16;
const int notes[] = {12, 24, 7, 12, 36, 12, 24, 15, 0, 12, 48, 36, 19, 24, 3, 36};
void setup() {
// We initialise the sound engine by calling Music.init() which outputs a tone
Music.init();
Music.enableEnvelope1();
Music.enableEnvelope2();
// These guys just have to be here...
usbMIDI.setHandleNoteOff(OnNoteOff);
usbMIDI.setHandleNoteOn(OnNoteOn);
usbMIDI.setHandleControlChange(OnControlChange);
// this is the sequencer code
Sequencer.init(128);
//Sequencer.newSequence(BPM, CALLBACK, SUBDIV);
// create new sequence and ID (s1)
s1 = Sequencer.newSequence(&s1cb, NOTE_16);
// start sequence 1
Sequencer.startSequence(s1);
// Loading a preset from EEPROM
Music.getPreset(16);
// Uncomment below if you want another midi note
// Music.noteOn(48,127);
}
void loop() {
// Checking for incoming MIDI to use dashboard
usbMIDI.read();
Sequencer.update();
}
// callback function for the step sequencer
void s1cb() {
Music.noteOn(notes[indx1++] + 24, 127);
if(indx1 >= nbr_notes) indx1 = 0;
}

View File

@ -0,0 +1,42 @@
#include <EEPROM.h>
#include <spi4teensy3.h>
#include <Mcp4251.h>
#include <Wire.h>
#include <Adafruit_TCS34725.h>
#include <HaarnetExtensionFlute.h>
int rgbc[4];
void setup() {
// Inititalise Flute
FluteEx.init();
}
void loop() {
Serial.print("Switch: "); Serial.println((FluteEx.switch_position() == true ? "A" : "B"));
Serial.print("PushButton: "); Serial.println((FluteEx.push_button() == true ? "ON" : "OFF"));
Serial.print("Touch A: "); Serial.println(FluteEx.touchA());
Serial.print("Touch B: "); Serial.println(FluteEx.touchB());
Serial.print("Touch C: "); Serial.println(FluteEx.touchC());
FluteEx.RGB(rgbc);
Serial.print("R: "); Serial.println(rgbc[0]);
Serial.print("G: "); Serial.println(rgbc[1]);
Serial.print("B: "); Serial.println(rgbc[2]);
Serial.print("C: "); Serial.println(rgbc[3]);
Serial.print("Lux B: "); Serial.println(FluteEx.luxB());
Serial.print("Mic: "); Serial.println(FluteEx.sample_mic(50));
Serial.println("....");
delay(150);
}