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 Prochaine révision Les deux révisions suivantes | ||
projets:artdevivre:accueil [2019/12/18 16:55] laurent [Matériaux] |
projets:artdevivre:accueil [2019/12/18 17:53] laurent [Photos] |
||
---|---|---|---|
Ligne 4: | Ligne 4: | ||
* Date : décembre / 2019 | * Date : décembre / 2019 | ||
* Licence : libre ! | * Licence : libre ! | ||
- | | + | * Fichiers : {{ : |
- | | + | * Lien : [[https:// |
- | * Lien : lien vers un site éventuellement | + | |
Ligne 30: | Ligne 29: | ||
Pour lire les valeurs brutes et calibrer les entrées analogiques, | Pour lire les valeurs brutes et calibrer les entrées analogiques, | ||
+ | <WRAP center round important 60%> | ||
+ | Les **#define** sont parfois ignorés pour les cartes Leonardo, Due et Micro par le pré-processeur des versions récentes d' | ||
+ | le code téléchargeable en en-tête n'en possède pas pour rester compatible avec toutes les versions d'IDE d' | ||
+ | </ | ||
+ | |||
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 63: | Ligne 67: | ||
}; | }; | ||
- | digital digitals[] = { {" | + | digital digitals[] = { {" |
- | | + | {" |
+ | | ||
+ | {" | ||
+ | |||
unsigned int digitalsCount = sizeof(digitals)/ | unsigned int digitalsCount = sizeof(digitals)/ | ||
Ligne 77: | 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 92: | 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 110: | 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 120: | 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 129: | Ligne 136: | ||
digitals[i].lastState = currentState; | digitals[i].lastState = currentState; | ||
} | } | ||
- | #if !defined(SERIAL) | + | #ifndef CALIBRATION |
MidiUSB.flush(); | MidiUSB.flush(); | ||
#endif | #endif | ||
Ligne 135: | 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}; | ||
Ligne 154: | Ligne 161: | ||
++++ | ++++ | ||
===== Photos ===== | ===== Photos ===== | ||
- | Autres photos, galerie, ... | + | |