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:malinette:accueil [2015/05/30 01:59] resonance [Teensy for Malinette 05/2015] |
projets:malinette:accueil [2018/01/18 13:02] (Version actuelle) resonance ancienne révision (2017/03/20 10:55) restaurée |
||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| ====== | ====== | ||
| - | * Porteur du projet : [[: | + | * Porteur du projet : [[: |
| - | * Contributeurs : [[http:// | + | |
| * Date : 2012-... | * Date : 2012-... | ||
| * Licence : GNU/GPL3 | * Licence : GNU/GPL3 | ||
| - | * Contexte : outil pédagogique, | + | * Contexte : Outil pédagogique, |
| - | * Fichiers | + | * Fichiers |
| - | * URL : [[http:// | + | |
| - | * TODO : [[.:todo|To do]] | + | |
| - | * IDEES : [[.: | + | |
| ===== Description ===== | ===== Description ===== | ||
| **La Malinette** est un kit pédagogique sous licence libre pour découvrir et apprendre à construire des systèmes interactifs. Il comprend un logiciel et du matériel électronique avec une carte électronique Arduino Roméo et un ensemble de capteurs et d' | **La Malinette** est un kit pédagogique sous licence libre pour découvrir et apprendre à construire des systèmes interactifs. Il comprend un logiciel et du matériel électronique avec une carte électronique Arduino Roméo et un ensemble de capteurs et d' | ||
| - | {{: | + | {{: |
| - | ===== Changements > 0.89 ===== | + | |
| - | * source bassdrum | + | |
| - | * audio-volume : inlet | + | |
| - | * video-motionblob : ajout 3eme sortie move : indique le niveau de mouvement... | + | |
| - | * video-motionstop : ajout des commandes : reset et depot ... | + | |
| - | * video-in > pix_rbga | + | |
| - | * 3d-transform > video-xyz | + | |
| - | * image-in | + | |
| - | * teensy-in, teensy-analog-in, | + | |
| - | * add bolpipe, audio-13eq | + | |
| - | * modif seq a 120ms, couleurs arduinos | + | |
| - | * une correction sur video-crop | + | |
| - | ===== Teensy ===== | + | |
| - | * [[.: | + | |
| - | + | ||
| - | ==== Teensy for Malinette 05/2015 ==== | + | |
| - | * Fichiers (Arduino et Pure Data) : {{: | + | |
| - | + | ||
| - | **Pure Data** | + | |
| - | {{: | + | |
| - | + | ||
| - | + | ||
| - | ++++ Code Arduino : teensy_malinette.ino | | + | |
| - | <code cpp> | + | |
| - | // TEENSY - MALINETTE | + | |
| - | // Control inputs and outputs with MIDI messages | + | |
| - | // 30/05/2015 - http:// | + | |
| - | + | ||
| - | #include < | + | |
| - | + | ||
| - | // Pins | + | |
| - | int anaPins[] = {16, | + | |
| - | int outPins[] = {9,10}; // output pins | + | |
| - | const int anaNb = 6; // number of inputs | + | |
| - | const int outNb = 2; // number of outputs | + | |
| - | + | ||
| - | // Midi Mapping | + | |
| - | int anaCtl[] = {5, | + | |
| - | int outCtl[] = {50, 51}; // controller out | + | |
| - | int anaStateCtl[] = {20, 21} ; // sensor on (20), sensor off (21) | + | |
| - | int outStateCtl[] = {60, 61}; // controller out modes (0,1,2,3) (none, digital, pwm, servo) | + | |
| - | + | ||
| - | // Ana Sensors | + | |
| - | int anaState[anaNb]; | + | |
| - | const int channel = 1; | + | |
| - | int anaValues[anaNb]; | + | |
| - | int anaLastValues[anaNb]; | + | |
| - | + | ||
| - | // Sampling rate | + | |
| - | const long interval = 30; | + | |
| - | unsigned long currentMillis; | + | |
| - | unsigned long previousMillis = 0; | + | |
| - | + | ||
| - | // Output | + | |
| - | Servo servo0, | + | |
| - | int outState[outNb]; | + | |
| - | + | ||
| - | void setup() { | + | |
| - | for (int i = 0; i < outNb; i++) { | + | |
| - | pinMode(outPins[i], | + | |
| - | } | + | |
| - | usbMIDI.setHandleControlChange(OnControlChange); | + | |
| - | } | + | |
| - | + | ||
| - | void loop() { | + | |
| - | currentMillis = millis(); | + | |
| - | if(currentMillis - previousMillis >= interval) | + | |
| - | previousMillis = currentMillis; | + | |
| - | for (int i = 0; i < anaNb; i++) { | + | |
| - | if(anaState[i] == 1) { // check first if the sensor is on | + | |
| - | anaValues[i] = analogRead(anaPins[i]) | + | |
| - | if (anaValues[i] != anaLastValues[i]) { | + | |
| - | usbMIDI.sendControlChange(anaCtl[i], | + | |
| - | anaLastValues[i] = anaValues[i]; | + | |
| - | } | + | |
| - | } | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | //Discard incoming MIDI messages. | + | |
| - | while (usbMIDI.read()) { | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | // Receive Midi Control Change | + | |
| - | void OnControlChange(byte channel, byte control, byte value) { | + | |
| - | + | ||
| - | // Analog sensors on/off | + | |
| - | if (control == anaStateCtl[0] ) {anaState[-value+(anaNb-1)] = 0;} | + | |
| - | else if (control == anaStateCtl[1] ) {anaState[-value+(anaNb-1)] = 1;} | + | |
| - | + | ||
| - | // Set Outputs Values | + | |
| - | else if (control == outCtl[0] ) {setOutValue(0, | + | |
| - | else if (control == outCtl[1] ) {setOutValue(1, | + | |
| - | + | ||
| - | // Set Outputs States (none, digital, pwm, servo) | + | |
| - | else if (control == outStateCtl[0] ) {setOutState(0, | + | |
| - | else if (control == outStateCtl[1] ) {setOutState(1, | + | |
| - | } | + | |
| - | + | ||
| - | // Set outputs | + | |
| - | void setOutValue(int outId, int value, Servo servo) { | + | |
| - | int state = outState[outId]; | + | |
| - | if( state == 1) { // digital mode | + | |
| - | | + | |
| - | | + | |
| - | } else if( state == 2){ // pwm mode | + | |
| - | analogWrite(outPins[outId], | + | |
| - | } else if( state == 3){ // servo mode | + | |
| - | if (servo.attached()) {servo.write(map(value, | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | void setOutState(int outId, int value, Servo servo) { | + | |
| - | // Check last state to turn off | + | |
| - | if ( outState[outId] == 1) {digitalWrite(outPins[outId], | + | |
| - | else if ( outState[outId] == 2) {analogWrite(outPins[outId], | + | |
| - | + | ||
| - | if (value == 3) { | + | |
| - | if (!servo.attached()) {servo.attach(outPins[outId]); | + | |
| - | } else { | + | |
| - | if (servo.attached()) {servo.detach(); | + | |
| - | } | + | |
| - | + | ||
| - | outState[outId] = value; | + | |
| - | } | + | |
| - | </ | + | |
| - | ++++ | + | |
| + | ===== Développement ===== | ||
| + | * [[.: | ||
| + | * [[.: | ||
| ===== Autres ===== | ===== Autres ===== | ||
| - | |||
| * [[.: | * [[.: | ||
| * [[.: | * [[.: | ||
| - | {{tag> | ||