Looking at your code, it appears to be quite simple. This is not directly related to your question, but it addresses theĬriticism you received for posting too large a program. Lower the detection threshold (your total constant) until you are at Make the pads as big as practically possible Make sure both you and the Arduino are properly grounded There are a few things you can do to increase the sensitivity though: Setup, as we are talking about fractions of a picofarad. “from at least a few inches away” is probably impossible with this You have to realize that you are trying to measure tinyĬapacitances, which is not completely trivial. If(yes10 = true & previous10 = false & c) If(yes11 = true & previous11 = false & b) If(yes12 = true & previous12 = false & a) Long total13 = cs_2_3.capacitiveSensor(sensor) Long total14 = cs_2_4.capacitiveSensor(sensor) Long total15 = cs_2_5.capacitiveSensor(sensor) Long total16 = cs_2_6.capacitiveSensor(sensor) Long total17 = cs_2_7.capacitiveSensor(sensor) Long total18 = cs_2_8.capacitiveSensor(sensor) Long total19 = cs_2_9.capacitiveSensor(sensor) Long total110 = cs_2_10.capacitiveSensor(sensor) Long total111 = cs_2_11.capacitiveSensor(sensor) Long total112 = cs_2_12.capacitiveSensor(sensor) #define replay 40 //define debouncing, high value will increase stability while increasing response timeĬapacitiveSensor cs_2_12 = CapacitiveSensor(2,12) // 2.2M resistor between pins 2 & 12, pin 2 is send pin, pin 12 is sensor pinĬapacitiveSensor cs_2_11 = CapacitiveSensor(2,11) // 2.2M resistor between pins 2 & 11, pin 2 is send pin, pin 11 is sensor pinĬapacitiveSensor cs_2_10 = CapacitiveSensor(2,10) // 2.2M resistor between pins 2 & 10, pin 2 is send pin, pin 10 is sensor pinĬapacitiveSensor cs_2_9 = CapacitiveSensor(2,9) ĬapacitiveSensor cs_2_8 = CapacitiveSensor(2,8) ĬapacitiveSensor cs_2_7 = CapacitiveSensor(2,7) ĬapacitiveSensor cs_2_6 = CapacitiveSensor(2,6) ĬapacitiveSensor cs_2_5 = CapacitiveSensor(2,5) ĬapacitiveSensor cs_2_4 = CapacitiveSensor(2,4) ĬapacitiveSensor cs_2_3 = CapacitiveSensor(2,3) Ĭs_2_12.set_CS_AutocaL_Millis(0xFFFFFFFF) //Calibrate the sensor.Ĭs_2_11.set_CS_AutocaL_Millis(0xFFFFFFFF) Ĭs_2_10.set_CS_AutocaL_Millis(0xFFFFFFFF) Ĭs_2_9.set_CS_AutocaL_Millis(0xFFFFFFFF) Ĭs_2_8.set_CS_AutocaL_Millis(0xFFFFFFFF) Ĭs_2_7.set_CS_AutocaL_Millis(0xFFFFFFFF) Ĭs_2_6.set_CS_AutocaL_Millis(0xFFFFFFFF) Ĭs_2_5.set_CS_AutocaL_Millis(0xFFFFFFFF) Ĭs_2_4.set_CS_AutocaL_Millis(0xFFFFFFFF) Ĭs_2_3.set_CS_AutocaL_Millis(0xFFFFFFFF) #define sensor 1 //define number of samples Arduino takes, high value will increase stability while increasing response time #define total 30 //define sensitivity, high value for decreases sensitivity, low value increases menu Import Minim library Declare Minim and AudioPlayer object Loop mp3 file Construct Minim object Load mp3 file into AudioPlayer object (file must be in. MyPort = new Serial(this, portName, 115200) String portName = "/dev/cu.usbmodem1411" //Change COM48 to the port number that your Arduino is connected, you can check the port number from arduino program. String val // Data received from the serial port Serial myPort // Create object from Serial class I've posted the schematic and code for Arduino and Processing below. I want it to start detecting my finger from at least a few inches away. Even after using a 10M ohm resistor, my program is only responding when I'm touching the electrodes. I went according to my design and tried it out. String completeString = myPort.I've made use of the cap sense library in Arduino to make a touch less piano. Minim minim //minim library class object called minim AudioPlayer song. Void serialEvent(Serial myPort) // Is called everytime there is new data to read To get a feel for using Minim, you will create a basic audio player application. Sound1 = minim.loadFile("roundLose.wav") MyPort = new Serial(this, Serial.list(), 9600) // Open a new port and connect with Arduino at 9600 baud Println(Serial.list()) // Prints the list of serial available devices (Arduino should be on top of the list) import rial.* // Import the Processing Serial Library for communicating with arduinoĪudioPlayer sound1, sound2, sound3, sound4 rewind() to reset the sound so it will play again I added it but it sounds like a chainsaw. I watched a tutorial and it said you need. I have it working for score1 - so the first time CPU plays sound1 but then it stops and doesn't work again. I'm trying to play a sound when someone scores.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |