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 | ||
|
wiki:flossmanuals:table-mixage-images:accueil [2021/06/07 14:40] damien.muti |
wiki:flossmanuals:table-mixage-images:accueil [2021/06/28 14:45] (Version actuelle) damien.muti |
||
|---|---|---|---|
| Ligne 17: | Ligne 17: | ||
| {{ : | {{ : | ||
| + | |||
| + | {{ : | ||
| ===== Algorithme ===== | ===== Algorithme ===== | ||
| Ligne 28: | Ligne 30: | ||
| le fichier Fritzing correspondant est le suivant : {{ : | le fichier Fritzing correspondant est le suivant : {{ : | ||
| - | ==== Programmes ==== | + | ==== Programmes |
| - | Le code permettant : | + | Le code permettant |
| - | * {{ : | + | * {{ : |
| < | < | ||
| - | /* Meet | + | int Sensor [ ] = {0, 0, 0, 0, 0}; |
| - | | + | byte N = 5; |
| - | | + | int inByte = 0; // incoming serial byte |
| - | Hangouts | + | |
| - | 2 sur 8 224 | + | |
| - | RFID | + | |
| - | Boîte de réception | + | |
| - | Théo Radakovitch < | + | |
| - | 14:43 (il y a 2 minutes) | + | boolean debug = false; |
| - | À moi, Célia | ||
| - | Traduire le message | ||
| - | Désactiver pour : anglais | ||
| - | /* Typical pin layout used: | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | SPI SS SDA(SS) | ||
| - | SPI MOSI MOSI 11 / ICSP-4 | ||
| - | SPI MISO MISO 12 / ICSP-1 | ||
| - | SPI SCK | ||
| - | */ | ||
| - | ////////////////////////// | ||
| - | #include " | ||
| + | void setup() { | ||
| + | // création du tableau Sensor | ||
| + | // Sensor = malloc(N*sizeof(int)); | ||
| - | #ifdef __AVR__ | + | Serial.begin(9600); |
| - | #include < | + | |
| - | SoftwareSerial SSerial(2, 3); // RX, TX | + | |
| - | #define COMSerial SSerial | + | } |
| - | #define ShowSerial Serial | + | |
| + | } | ||
| - | WT2003S< | ||
| - | #endif | ||
| - | #ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE | + | void loop() { |
| - | #define COMSerial Serial1 | + | for (int i = 0; i < N; i++) { |
| - | #define ShowSerial SerialUSB | + | // |
| - | + | | |
| - | WT2003S< | + | // |
| - | #endif | + | |
| - | + | | |
| - | #ifdef ARDUINO_ARCH_STM32F4 | + | |
| - | #define COMSerial Serial | + | |
| - | #define ShowSerial SerialUSB | + | |
| - | + | | |
| - | WT2003S< | + | } |
| - | #endif | + | |
| - | + | | |
| - | + | } | |
| - | uint8_t vol = 31; | + | |
| - | uint32_t spi_flash_songs | + | |
| - | uint32_t sd_songs = 0; | + | |
| - | STROAGE workdisk = SD; | + | |
| - | struct Play_history | + | |
| - | | + | |
| - | | + | |
| - | char name[8]; | + | |
| - | }* SPISong, *SDSong; | + | |
| - | + | ||
| - | void readSongName(struct Play_history* ph, uint32_t num, STROAGE disk) { | + | |
| - | | + | |
| - | delay(100); | + | |
| - | | + | |
| - | case SPIFLASH: | + | |
| - | | + | |
| - | | + | |
| - | case SD: | + | |
| - | Mp3Player.playSDRootSong(0x0001); | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| } | } | ||
| - | | + | |
| - | for (int i = 0; i < num ; i++) { | + | |
| - | | + | |
| - | ph[i].disk = disk; | + | |
| - | ph[i].index = Mp3Player.getTracks(); | + | |
| - | Mp3Player.getSongName(ph[i].name); | + | |
| - | Mp3Player.next(); | + | |
| } | } | ||
| - | ShowSerial.println(" | ||
| - | Mp3Player.pause_or_play(); | ||
| - | Mp3Player.volume(14); | ||
| - | delay(100); | ||
| } | } | ||
| - | void getAllSong() { | + | void establishContact() { |
| - | | + | |
| - | ShowSerial.println(diskstatus); | + | |
| - | spi_flash_songs | + | |
| - | ShowSerial.print(" | + | |
| - | ShowSerial.println(spi_flash_songs); | + | |
| - | if (spi_flash_songs > 0) { | + | |
| - | | + | |
| - | readSongName(SPISong, | + | |
| - | } | + | |
| - | if (diskstatus && 0x02) { // have SD | + | |
| - | | + | |
| - | ShowSerial.print(" | + | |
| - | ShowSerial.println(sd_songs); | + | |
| - | if (sd_songs > 0) { | + | |
| - | SDSong = (struct Play_history*)malloc((sd_songs + 1) * sizeof(struct Play_history)); | + | |
| - | ShowSerial.println(" | + | |
| - | readSongName(SDSong, | + | |
| - | } | + | |
| } | } | ||
| } | } | ||
| - | void printSongs() { | + | </code> |
| - | ShowSerial.print(" | + | |
| - | ShowSerial.print(" | + | |
| - | ShowSerial.print(" | + | |
| - | ShowSerial.print(" | + | |
| - | ShowSerial.print(" | + | |
| - | ShowSerial.println(); | + | |
| - | ShowSerial.println(" | + | |
| - | for (int i = 0 ; i < spi_flash_songs; | + | |
| - | ShowSerial.print(" | + | |
| - | ShowSerial.print(SPISong[i].index); | + | |
| - | ShowSerial.print("< | + | |
| - | ShowSerial.print(SPISong[i].name); | + | |
| - | ShowSerial.print(" | + | |
| - | ShowSerial.println(); | + | |
| - | } | + | |
| - | ShowSerial.println(" | + | |
| - | for (int i = 0 ; i < sd_songs; i++) { | + | |
| - | ShowSerial.print(" | + | |
| - | ShowSerial.print(SDSong[i].index); | + | |
| - | ShowSerial.print("< | + | |
| - | ShowSerial.print(SDSong[i].name); | + | |
| - | ShowSerial.print(" | + | |
| - | ShowSerial.println(); | + | |
| - | } | + | |
| - | } | + | |
| - | //////////////////////////////// | + | |
| - | #include < | + | |
| - | #include < | + | |
| - | #define SS_PIN 10 | + | ===== Programme Processing ===== |
| - | #define RST_PIN 9 | + | |
| - | MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class | + | Le programme Processing permettant de récupérer les données envoyées par la cartes et de les considérer comme des paramètres permettant de faire varier les aspects visuels d'une images |
| - | MFRC522::MIFARE_Key key; | + | * {{ :wiki:flossmanuals: |
| - | // Init array that will store new NUID | + | < |
| - | byte nuidPICC[4]; | + | /** |
| + | * Serial Call-Response | ||
| + | * by Tom Igoe. | ||
| + | * | ||
| + | * Sends a byte out the serial port, and reads 3 bytes in. | ||
| + | * Sets foregound color, red, and green of a circle onstage | ||
| + | * using the values returned from the serial port. | ||
| + | * Thanks to Daniel Shiffman | ||
| + | * | ||
| + | * Note: This sketch assumes | ||
| + | * port is going to send a single | ||
| + | * The sketch waits for that byte, then sends an ASCII A whenever | ||
| + | * it wants more data. | ||
| + | */ | ||
| - | int valRFID = 0; // numéro | + | //déclaration |
| + | PImage img1; | ||
| + | //je ne sais pas encore quels sont ces entiers | ||
| + | int picAlpha = 255; | ||
| - | //DFPLAYER | + | import processing.serial.*; |
| - | #include < | + | int bgcolor; |
| + | //int fgcolor; | ||
| + | Serial myPort; | ||
| + | int N = 5 ; // nombre de valeurs lue, venant de la carte Arduino | ||
| + | int[] serialInArray = new int[N]; | ||
| + | int serialCount = 0; // A count of how many bytes we receive | ||
| + | int red, green, blue, alpha, filt; | ||
| + | boolean firstContact = false; | ||
| + | void setup() { | ||
| + | size(420, 420); // Stage size | ||
| + | noStroke(); | ||
| + | img1= loadImage(" | ||
| + | //img1= loadImage(" | ||
| + | //img1= loadImage(" | ||
| + | img1.resize(410, | ||
| - | int ledPin = 6; | ||
| + | // parametres associés aux boutons Sensor lus par la carte arduino | ||
| + | red = width/2; | ||
| + | green = height/2; | ||
| + | blue=0; | ||
| + | alpha=0; | ||
| + | filt=2; | ||
| + | // Print a list of the serial ports, for debugging purposes: | ||
| + | printArray(Serial.list()); | ||
| - | void setup() | + | // I know that the first port in the serial list on my mac |
| - | { | + | // is always my FTDI adaptor, so I open Serial.list()[0]. |
| - | //Serial.begin(115200); | + | // On Windows machines, this generally opens COM1. |
| - | + | // Open whatever port is the one you're using. | |
| - | | + | |
| - | | + | |
| - | + | } | |
| - | | + | |
| - | key.keyByte[i] = 0xFF; | + | |
| - | } | + | |
| - | + | ||
| - | | + | |
| - | Serial.print(F(" | + | |
| - | printHex(key.keyByte, MFRC522:: | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | Serial.println(" | + | |
| - | + | ||
| - | ///////////////// | + | |
| - | while (!ShowSerial); | + | void draw() { // affichage dans la fenêtre graphique |
| - | ShowSerial.begin(9600); | + | |
| - | COMSerial.begin(9600); | + | |
| - | ShowSerial.println(" | + | |
| - | Mp3Player.init(COMSerial); | + | |
| - | | + | |
| - | | + | |
| - | printSongs(); | + | |
| - | Mp3Player.volume(vol); | + | |
| + | background(255); | ||
| + | fill(255); | ||
| + | tint(green+100, | ||
| + | image(img1, 5, 5);//imoage + positionnement de l' | ||
| + | // Draw the shape | ||
| + | // | ||
| + | | ||
| + | filter(POSTERIZE, | ||
| } | } | ||
| - | void light() { // éclaire | + | void serialEvent(Serial myPort) { // gestion du dialogue avec la carte Arduino |
| - | | + | |
| - | | + | int inByte = myPort.read(); |
| - | } | + | |
| + | // clear the serial buffer and note that you' | ||
| + | // had first contact from the microcontroller. | ||
| + | // Otherwise, add the incoming byte to the array: | ||
| + | if (firstContact == false) { | ||
| + | if (inByte == ' | ||
| + | myPort.clear(); // clear the serial port buffer | ||
| + | | ||
| + | myPort.write(' | ||
| + | | ||
| + | } else { | ||
| + | // Add the latest byte from the serial port to array: | ||
| + | serialInArray[serialCount] = inByte; | ||
| + | serialCount++; | ||
| + | // If we have N bytes: | ||
| + | if (serialCount > N-1 ) { | ||
| + | red = serialInArray[0]; | ||
| + | green = serialInArray[1]; | ||
| + | blue = serialInArray[2]; | ||
| + | alpha = serialInArray[3]; | ||
| + | filt = serialInArray[4]; | ||
| - | void printHex(byte *buffer, byte bufferSize) { | + | // print the values |
| - | | + | |
| - | Serial.print(buffer[i] < 0x10 ? " | + | |
| - | Serial.print(buffer[i], | + | |
| - | } | + | |
| - | } | + | |
| - | /** | + | |
| - | | + | |
| - | */ | + | // Reset serialCount: |
| - | void printDec(byte *buffer, byte bufferSize) { | + | serialCount |
| - | for (byte i = 0; i < bufferSize ; i++) { | + | } |
| - | Serial.print(buffer[i] < 0x10 ? " 0" | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| } | } | ||
| } | } | ||
| - | int convertNumRFID(byte *buffer, byte bufferSize) { | ||
| - | int valRFID = 0; | ||
| - | for (byte i = 0; i < bufferSize ; i++) { | ||
| - | valRFID += buffer[i]; | ||
| - | } | ||
| - | Serial.print(" | ||
| - | Serial.println(valRFID); | ||
| - | return valRFID; | ||
| - | } | ||
| - | |||
| - | void audio(int cmd) { | ||
| - | ShowSerial.print(" | ||
| - | if (workdisk == SD) { | ||
| - | Mp3Player.playSDRootSong(cmd); | ||
| - | ShowSerial.print(cmd + ": "); | ||
| - | ShowSerial.print(SDSong[cmd - ' | ||
| - | } | ||
| - | if (workdisk == SPIFLASH) { | ||
| - | Mp3Player.playSPIFlashSong(cmd - ' | ||
| - | ShowSerial.print(cmd + ": "); | ||
| - | ShowSerial.print(SPISong[cmd - ' | ||
| - | } | ||
| - | ShowSerial.println(); | ||
| - | } | ||
| - | |||
| - | void loop() { | ||
| - | |||
| - | // Reset the loop if no new card present on the sensor/ | ||
| - | if ( ! rfid.PICC_IsNewCardPresent()) | ||
| - | return; | ||
| - | |||
| - | // Verify if the NUID has been readed | ||
| - | if ( ! rfid.PICC_ReadCardSerial()) | ||
| - | return; | ||
| - | |||
| - | printDec(rfid.uid.uidByte, | ||
| - | valRFID = convertNumRFID(rfid.uid.uidByte, | ||
| - | //debug | ||
| - | Serial.print(" | ||
| - | Serial.println(valRFID); | ||
| - | |||
| - | |||
| - | Serial.println(); | ||
| - | |||
| - | // Halt PICC | ||
| - | rfid.PICC_HaltA(); | ||
| - | |||
| - | // Stop encryption on PCD | ||
| - | rfid.PCD_StopCrypto1(); | ||
| - | |||
| - | |||
| - | // | ||
| - | // | ||
| - | |||
| - | if (valRFID == 387) { // Sapin | ||
| - | audio(1); | ||
| - | Serial.println(" | ||
| - | light(); | ||
| - | } | ||
| - | |||
| - | if (valRFID == 403) { //Ours | ||
| - | audio(7); | ||
| - | Serial.println(" | ||
| - | light(); | ||
| - | } | ||
| - | |||
| - | if (valRFID == 280) { // Chien | ||
| - | audio(3); | ||
| - | Serial.println(" | ||
| - | light(); | ||
| - | } | ||
| - | |||
| - | if (valRFID == 499) { // Chaise | ||
| - | audio(4); | ||
| - | Serial.println(" | ||
| - | light(); | ||
| - | } | ||
| - | |||
| - | if (valRFID == 607) { // Bateau | ||
| - | audio(5); | ||
| - | Serial.println(" | ||
| - | light(); | ||
| - | } | ||
| - | if (valRFID == 673) { // Perroquet | ||
| - | audio(6); | ||
| - | Serial.println(" | ||
| - | light(); | ||
| - | } | ||
| - | if (valRFID == 581) { // Vache | ||
| - | audio(2); | ||
| - | Serial.println(" | ||
| - | light(); | ||
| - | } | ||
| - | } | ||
| </ | </ | ||
| - | Pour que ce code fonctionne, il convient de placer les sons au formats " | ||
| - | * Sapin | ||
| - | * Ours | ||
| - | * Chien | ||
| - | * Chaise | ||
| - | * Bateau | ||
| - | * Perroquet | ||
| - | * Vache | ||
| - | L' | + | ===== Réalisation de la maquette et visuels ===== |
| - | ==== Références : Contrôle d’accès par badge RFID avec Arduino | + | |
| - | Le programme permettant de détecter l' | + | |
| + | {{ : | ||
| + | {{ : | ||
| + | {{ : | ||
| + | {{ : | ||
| + | {{ : | ||
| - | ===== Réalisation de la maquette ===== | ||
| - | vidéos, photos du making of... | ||
| + | ===== Références : ===== | ||
| + | La documentation sur les filtres d' | ||
| + | * [[https:// | ||