Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
projets:artdevivre:accueil [2019/12/18 17:35] laurent [code] |
projets:artdevivre:accueil [2019/12/19 15:05] (Version actuelle) laurent [Description] |
||
---|---|---|---|
Ligne 13: | Ligne 13: | ||
===== Description ===== | ===== Description ===== | ||
Dans le cadre de la création de son spectacle **Rien n' | Dans le cadre de la création de son spectacle **Rien n' | ||
- | L' | + | L' |
- | Nous avons conçu autours | + | Ces huit levier ON/OFF actionnerons des sons, un neuvième levier gradué permettra |
- | Enfin, un cadre maintenant solidement le tout à été fabriqué en acier soudé. | + | Les pièces nécessaires à ce fonctionnement (butées avant et arrières et le ressort de rappel, maintien des boutons poussoirs...) ont été conçues autour de ces leviers et découpé au LFO. Enfin, un cadre maintenant solidement le tout à été fabriqué en acier soudé. |
===== Matériaux ===== | ===== Matériaux ===== | ||
Ligne 36: | Ligne 36: | ||
Le code du projet peut être consulté ci-dessous : | Le code du projet peut être consulté ci-dessous : | ||
++++ arduinoLeonardo.ino| | ++++ arduinoLeonardo.ino| | ||
- | <code cpp>//# | + | <code cpp>//# |
- | #if !defined(SERIAL) | + | #ifndef CALIBRATION |
#include " | #include " | ||
#endif | #endif | ||
Ligne 67: | Ligne 67: | ||
}; | }; | ||
- | digital digitals[] = { {" | + | digital digitals[] = { {" |
- | | + | {" |
+ | | ||
+ | {" | ||
+ | |||
unsigned int digitalsCount = sizeof(digitals)/ | unsigned int digitalsCount = sizeof(digitals)/ | ||
Ligne 81: | Ligne 84: | ||
analogs[i].currentValue = map(analogRead(analogs[i].pin), | analogs[i].currentValue = map(analogRead(analogs[i].pin), | ||
} | } | ||
- | #if defined(SERIAL) | + | #ifdef CALIBRATION |
Serial.begin(115200); | Serial.begin(115200); | ||
delay(100); | delay(100); | ||
Ligne 96: | Ligne 99: | ||
//if (analogs[i].lastValue != analogs[i].currentValue) { | //if (analogs[i].lastValue != analogs[i].currentValue) { | ||
if (analogs[i].lastValue < analogs[i].currentValue - analogs[i].deadBand || analogs[i].lastValue > analogs[i].currentValue + analogs[i].deadBand) { | if (analogs[i].lastValue < analogs[i].currentValue - analogs[i].deadBand || analogs[i].lastValue > analogs[i].currentValue + analogs[i].deadBand) { | ||
- | #if defined(SERIAL) | + | #ifdef CALIBRATION |
Serial.println(analogs[i].name + ": RAW" | Serial.println(analogs[i].name + ": RAW" | ||
// | // | ||
Ligne 114: | Ligne 117: | ||
// input has been pulled LOW | // input has been pulled LOW | ||
if (currentState == LOW && digitals[i].lastState == HIGH && millis() - digitals[i].lastTriggered > digitals[i].debounce) { | if (currentState == LOW && digitals[i].lastState == HIGH && millis() - digitals[i].lastTriggered > digitals[i].debounce) { | ||
- | #if defined(SERIAL) | + | #ifdef CALIBRATION |
Serial.println(digitals[i].name+": | Serial.println(digitals[i].name+": | ||
#else | #else | ||
Ligne 124: | Ligne 127: | ||
// input has been pulled HIGH | // input has been pulled HIGH | ||
if (currentState == HIGH && digitals[i].lastState == LOW && millis() - digitals[i].lastTriggered > digitals[i].debounce) { | if (currentState == HIGH && digitals[i].lastState == LOW && millis() - digitals[i].lastTriggered > digitals[i].debounce) { | ||
- | #if defined(SERIAL) | + | #ifdef CALIBRATION |
Serial.println(digitals[i].name+": | Serial.println(digitals[i].name+": | ||
#else | #else | ||
Ligne 133: | Ligne 136: | ||
digitals[i].lastState = currentState; | digitals[i].lastState = currentState; | ||
} | } | ||
- | #if !defined(SERIAL) | + | #ifndef CALIBRATION |
MidiUSB.flush(); | MidiUSB.flush(); | ||
#endif | #endif | ||
Ligne 139: | Ligne 142: | ||
} | } | ||
- | #if !defined(SERIAL) | + | #ifndef CALIBRATION |
void noteOn(byte pitch, byte velocity) { | void noteOn(byte pitch, byte velocity) { | ||
midiEventPacket_t noteOn = {0x09, 0x90 | CHANNEL, pitch, velocity}; | midiEventPacket_t noteOn = {0x09, 0x90 | CHANNEL, pitch, velocity}; |