diff --git a/V3-WeMos/Arduino/Left/Left.ino b/V3-WeMos/Arduino/Left/Left.ino new file mode 100644 index 0000000..8aaf8ef --- /dev/null +++ b/V3-WeMos/Arduino/Left/Left.ino @@ -0,0 +1,129 @@ + +#include +#include +#include +#include +#include + +const int MPU=0x68; +int16_t AcX,AcY,AcZ; + +char ssid[] = "NETGEAR41"; +char pass[] = "magicalbanana0"; + +WiFiUDP Udp; +const IPAddress outIp(192,168,0,29); // remote IP of receiver computer +const unsigned int outPort = 7000; // remote port to receive OSC + + +int fingerGround = 15; +int fingerSignal = 18; +int finger1 = 16; +int finger2 = 14; +int finger3 = 12; +int finger4 = 13; + +void setup() { + + Wire.begin(); + Wire.beginTransmission(MPU); + Wire.write(0x6B); + Wire.write(0); + Wire.endTransmission(true); + + Serial.begin(115200); + + Serial.print("Connecting to "); + Serial.println(ssid); + WiFi.begin(ssid, pass); + + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + + Serial.println(""); + Serial.println("WiFi connected"); + Serial.println("IP address: "); + Serial.println(WiFi.localIP()); + + pinMode(fingerSignal, OUTPUT); + pinMode(fingerGround, OUTPUT); + digitalWrite(fingerSignal, HIGH); + digitalWrite(fingerGround, LOW); + + pinMode(finger1, INPUT); + pinMode(finger2, INPUT); + pinMode(finger3, INPUT); + pinMode(finger4, INPUT); + +} + +void loop() { + + Wire.beginTransmission(MPU); + Wire.write(0x3B); + Wire.endTransmission(false); + Wire.requestFrom(MPU,14); + AcX=Wire.read()<<8|Wire.read(); + AcY=Wire.read()<<8|Wire.read(); + AcZ=Wire.read()<<8|Wire.read(); + + Serial.print(AcX); + Serial.print("\t"); + Serial.print(AcY); + Serial.print("\t"); + Serial.print(digitalRead(finger1)); + Serial.print("\t"); + Serial.print(digitalRead(finger2)); + Serial.print("\t"); + Serial.print(digitalRead(finger3)); + Serial.print("\t"); + Serial.print(digitalRead(finger4)); + Serial.println("\t"); + //Serial.println(AcZ); + + OSCMessage msgLX("/movedulation/sliderLX"); + msgLX.add(AcX); + Udp.beginPacket(outIp, outPort); + msgLX.send(Udp); + Udp.endPacket(); + msgLX.empty(); + + OSCMessage msgLY("/movedulation/sliderLY"); + msgLY.add(AcY); + Udp.beginPacket(outIp, outPort); + msgLY.send(Udp); + Udp.endPacket(); + msgLY.empty(); + + OSCMessage msgL1("/movedulation/toggleL1"); + msgL1.add(digitalRead(finger1)); + Udp.beginPacket(outIp, outPort); + msgL1.send(Udp); + Udp.endPacket(); + msgL1.empty(); + + OSCMessage msgL2("/movedulation/toggleL2"); + msgL2.add(digitalRead(finger2)); + Udp.beginPacket(outIp, outPort); + msgL2.send(Udp); + Udp.endPacket(); + msgL2.empty(); + + OSCMessage msgL3("/movedulation/toggleL3"); + msgL3.add(digitalRead(finger3)); + Udp.beginPacket(outIp, outPort); + msgL3.send(Udp); + Udp.endPacket(); + msgL3.empty(); + + OSCMessage msgL4("/movedulation/toggleL4"); + msgL4.add(digitalRead(finger4)); + Udp.beginPacket(outIp, outPort); + msgL4.send(Udp); + Udp.endPacket(); + msgL4.empty(); + + delay(100); +} diff --git a/V3-WeMos/Arduino/Right/Right.ino b/V3-WeMos/Arduino/Right/Right.ino new file mode 100644 index 0000000..50b7fb1 --- /dev/null +++ b/V3-WeMos/Arduino/Right/Right.ino @@ -0,0 +1,129 @@ + +#include +#include +#include +#include +#include + +const int MPU=0x68; +int16_t AcX,AcY,AcZ; + +char ssid[] = "NETGEAR41"; +char pass[] = "magicalbanana0"; + +WiFiUDP Udp; +const IPAddress outIp(192,168,0,29); // remote IP of receiver computer +const unsigned int outPort = 7000; // remote port to receive OSC + + +int fingerGround = 15; +int fingerSignal = 18; +int finger1 = 16; +int finger2 = 14; +int finger3 = 12; +int finger4 = 13; + +void setup() { + + Wire.begin(); + Wire.beginTransmission(MPU); + Wire.write(0x6B); + Wire.write(0); + Wire.endTransmission(true); + + Serial.begin(115200); + + Serial.print("Connecting to "); + Serial.println(ssid); + WiFi.begin(ssid, pass); + + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + + Serial.println(""); + Serial.println("WiFi connected"); + Serial.println("IP address: "); + Serial.println(WiFi.localIP()); + + pinMode(fingerSignal, OUTPUT); + pinMode(fingerGround, OUTPUT); + digitalWrite(fingerSignal, HIGH); + digitalWrite(fingerGround, LOW); + + pinMode(finger1, INPUT); + pinMode(finger2, INPUT); + pinMode(finger3, INPUT); + pinMode(finger4, INPUT); + +} + +void loop() { + + Wire.beginTransmission(MPU); + Wire.write(0x3B); + Wire.endTransmission(false); + Wire.requestFrom(MPU,14); + AcX=Wire.read()<<8|Wire.read(); + AcY=Wire.read()<<8|Wire.read(); + AcZ=Wire.read()<<8|Wire.read(); + + Serial.print(AcX); + Serial.print("\t"); + Serial.print(AcY); + Serial.print("\t"); + Serial.print(digitalRead(finger1)); + Serial.print("\t"); + Serial.print(digitalRead(finger2)); + Serial.print("\t"); + Serial.print(digitalRead(finger3)); + Serial.print("\t"); + Serial.print(digitalRead(finger4)); + Serial.println("\t"); + //Serial.println(AcZ); + + OSCMessage msgRX("/movedulation/sliderRX"); + msgRX.add(AcX); + Udp.beginPacket(outIp, outPort); + msgRX.send(Udp); + Udp.endPacket(); + msgRX.empty(); + + OSCMessage msgRY("/movedulation/sliderRY"); + msgRY.add(AcY); + Udp.beginPacket(outIp, outPort); + msgRY.send(Udp); + Udp.endPacket(); + msgRY.empty(); + + OSCMessage msgR1("/movedulation/toggleR1"); + msgR1.add(digitalRead(finger1)); + Udp.beginPacket(outIp, outPort); + msgR1.send(Udp); + Udp.endPacket(); + msgR1.empty(); + + OSCMessage msgR2("/movedulation/toggleR2"); + msgR2.add(digitalRead(finger2)); + Udp.beginPacket(outIp, outPort); + msgR2.send(Udp); + Udp.endPacket(); + msgR2.empty(); + + OSCMessage msgR3("/movedulation/toggleR3"); + msgR3.add(digitalRead(finger3)); + Udp.beginPacket(outIp, outPort); + msgR3.send(Udp); + Udp.endPacket(); + msgR3.empty(); + + OSCMessage msgR4("/movedulation/toggleR4"); + msgR4.add(digitalRead(finger4)); + Udp.beginPacket(outIp, outPort); + msgR4.send(Udp); + Udp.endPacket(); + msgR4.empty(); + + delay(100); +} diff --git a/V3-WeMos/Circuit/CIRCUIT.pdf b/V3-WeMos/Circuit/CIRCUIT.pdf index 1ea5d57..33aa8cc 100644 Binary files a/V3-WeMos/Circuit/CIRCUIT.pdf and b/V3-WeMos/Circuit/CIRCUIT.pdf differ diff --git a/V3-WeMos/Circuit/CIRCUIT.svg b/V3-WeMos/Circuit/CIRCUIT.svg index 0448319..c5a2f2a 100644 --- a/V3-WeMos/Circuit/CIRCUIT.svg +++ b/V3-WeMos/Circuit/CIRCUIT.svg @@ -22,11 +22,11 @@ borderopacity="1.0" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:zoom="1.4142136" - inkscape:cx="-56.566571" - inkscape:cy="122.91612" + inkscape:zoom="1.8093187" + inkscape:cx="26.390576" + inkscape:cy="37.611486" inkscape:document-units="cm" - inkscape:current-layer="g6108" + inkscape:current-layer="g2383" showgrid="true" inkscape:window-width="1366" inkscape:window-height="719" @@ -389,6 +389,11 @@ id="path2501" d="m -848.73422,921.21359 c -1.2858,-1.86754 -3.88474,-2.3456 -5.75227,-1.05981 -1.86753,1.2858 -2.3467,3.88313 -1.0609,5.75067 1.28579,1.86754 3.88312,2.34669 5.75066,1.0609 1.86754,-1.28579 2.34832,-3.88423 1.06251,-5.75176 z m -2.30807,1.5891 c 0.42721,0.6205 0.27806,1.42897 -0.34244,1.85619 -0.62051,0.42722 -1.42737,0.27696 -1.85459,-0.34354 -0.42721,-0.6205 -0.27967,-1.42788 0.34084,-1.85509 0.6205,-0.42722 1.42897,-0.27807 1.85619,0.34244 z" style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:0.99619669;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.979133;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1" /> + + @@ -1795,7 +1806,7 @@ style="opacity:1;fill:#ffffff;stroke-width:1.33264;stop-opacity:1" inkscape:connector-curvature="0" class="ism-s" - d="m -455.608,1.3614417 -0.84134,0.052 c -0.0187,-0.1373332 -0.056,-0.2413331 -0.112,-0.3119997 -0.0907,-0.11599987 -0.22133,-0.17466647 -0.39066,-0.17466647 -0.12667,0 -0.22267,0.0293333 -0.292,0.0893333 -0.068,0.058667 -0.10267,0.1279998 -0.10267,0.2053331 0,0.074667 0.032,0.1399998 0.0973,0.1986664 0.0653,0.058667 0.216,0.1133332 0.45333,0.1666665 0.388,0.085333 0.66533,0.2026665 0.83066,0.3466663 0.16667,0.1453332 0.25067,0.329333 0.25067,0.5533328 0,0.1466665 -0.0427,0.2866663 -0.128,0.4159995 -0.0853,0.1319999 -0.21333,0.2346664 -0.38533,0.3079997 -0.17067,0.076 -0.40667,0.1119999 -0.704,0.1119999 -0.36533,0 -0.644,-0.068 -0.836,-0.2026665 -0.19333,-0.1373332 -0.30667,-0.3533329 -0.344,-0.6493326 l 0.83467,-0.048 c 0.0227,0.1279999 0.0693,0.2213331 0.13866,0.2813331 0.072,0.057333 0.16934,0.086666 0.29467,0.086666 0.10267,0 0.18,-0.022667 0.232,-0.065333 0.052,-0.044 0.0787,-0.097333 0.0787,-0.1599999 0,-0.045333 -0.0213,-0.085333 -0.064,-0.1226665 -0.0413,-0.037333 -0.13999,-0.073333 -0.29733,-0.1053332 -0.38666,-0.082667 -0.664,-0.1679998 -0.83066,-0.2519997 -0.168,-0.085333 -0.28934,-0.1919998 -0.36534,-0.317333 -0.076,-0.1266666 -0.11466,-0.2666664 -0.11466,-0.4226663 0,-0.1853331 0.0507,-0.35466474 0.152,-0.50799791 0.10133,-0.15599983 0.244,-0.27333304 0.42533,-0.35333295 0.18267,-0.0813333 0.41333,-0.1213332 0.69067,-0.1213332 0.48666,0 0.82399,0.0933332 1.01199,0.28133303 0.188,0.18799979 0.292,0.42799803 0.31734,0.71733133 z" + d="m -455.608,1.3614417 -0.84134,0.052 c -0.0187,-0.1373332 -0.056,-0.2413331 -0.112,-0.3119997 -0.0907,-0.11599987 -0.22133,-0.17466647 -0.39066,-0.17466647 -0.12667,0 -0.22267,0.0293333 -0.292,0.0893333 -0.068,0.058667 -0.10267,0.1279998 -0.10267,0.2053331 0,0.074667 0.032,0.1399998 0.0973,0.1986664 0.0653,0.058667 0.216,0.1133332 0.45333,0.1666665 0.388,0.085333 0.66533,0.2026665 0.83066,0.3466663 0.16667,0.1453332 0.25067,0.329333 0.25067,0.5533328 0,0.1466665 -0.0427,0.2866663 -0.128,0.4159995 -0.0853,0.1319999 -0.21333,0.2346664 -0.38533,0.3079997 -0.17067,0.076 -0.40667,0.1119999 -0.704,0.1119999 -0.36533,0 -0.644,-0.068 -0.836,-0.2026665 -0.19333,-0.1373332 -0.30667,-0.3533329 -0.344,-0.6493326 l 0.83467,-0.048 c 0.0227,0.1279999 0.0693,0.2213331 0.13866,0.2813331 0.072,0.057333 0.16934,0.086666 0.29467,0.086666 0.10267,0 0.18,-0.022667 0.232,-0.065333 0.052,-0.044 0.0787,-0.097333 0.0787,-0.1599999 0,-0.045333 -0.0213,-0.085333 -0.064,-0.1226665 -0.0413,-0.037333 -0.13999,-0.073333 -0.29733,-0.1053332 -0.38666,-0.082667 -0.664,-0.1679998 -0.83066,-0.2519997 -0.168,-0.085333 -0.28934,-0.1919998 -0.36534,-0.317333 -0.076,-0.1266666 -0.11466,-0.2666664 -0.11466,-0.4226663 0,-0.1853331 0.0507,-0.35466462 0.152,-0.50799779 0.10133,-0.15599983 0.244,-0.27333304 0.42533,-0.35333295 0.18267,-0.0813333 0.41333,-0.1213332 0.69067,-0.1213332 0.48666,0 0.82399,0.0933332 1.01199,0.28133303 0.188,0.18799979 0.292,0.42799791 0.31734,0.71733121 z" id="path4102-1" /> @@ -2713,6 +2730,8 @@ + + @@ -2960,13 +2981,13 @@ stroke-width="0.0562573" /> @@ -4279,6 +4310,8 @@ + + diff --git a/V3-WeMos/ProcessingTestReceive/ProcessingTestReceive.pde b/V3-WeMos/ProcessingTestReceive/ProcessingTestReceive.pde deleted file mode 100644 index 442672a..0000000 --- a/V3-WeMos/ProcessingTestReceive/ProcessingTestReceive.pde +++ /dev/null @@ -1,27 +0,0 @@ - -import oscP5.*; -import netP5.*; - -OscP5 oscP5; - -void setup() { - size(400,400); - frameRate(25); - oscP5 = new OscP5(this,7000); -} - -void draw() { - background(0); -} - -void oscEvent(OscMessage theOscMessage) { - print("### Pattern: "+theOscMessage.addrPattern()); - print(" TypeTag:"+theOscMessage.typetag()); - if(theOscMessage.checkTypetag("i")){ - print(" Value: "+theOscMessage.get(0).intValue()); - } - if(theOscMessage.checkTypetag("s")){ - print(" Value: "+theOscMessage.get(0)); - } - println(); -} diff --git a/V3-WeMos/ESP8266sendMessage/ESP8266sendMessage.ino b/V3-WeMos/Tests/ESP8266sendMessage/ESP8266sendMessage.ino similarity index 100% rename from V3-WeMos/ESP8266sendMessage/ESP8266sendMessage.ino rename to V3-WeMos/Tests/ESP8266sendMessage/ESP8266sendMessage.ino diff --git a/V3-WeMos/Tests/ProcessingTestReceive/ProcessingTestReceive.pde b/V3-WeMos/Tests/ProcessingTestReceive/ProcessingTestReceive.pde new file mode 100644 index 0000000..db5a295 --- /dev/null +++ b/V3-WeMos/Tests/ProcessingTestReceive/ProcessingTestReceive.pde @@ -0,0 +1,105 @@ + +import oscP5.*; +import netP5.*; + +int sliderRX = 0; +int sliderRY = 0; +int sliderLX = 0; +int sliderLY = 0; +int fingersR[] = {0, 0, 0, 0}; +int fingersL[] = {0, 0, 0, 0}; + +OscP5 oscP5; + +void setup() { + size(400, 250); + frameRate(25); + oscP5 = new OscP5(this, 7000); +} + +void draw() { + background(0); + fill(255); + stroke(255); + strokeWeight(4); + + line(100, 25, 100, 175); + line(25, 100, 175, 100); + circle(100, map(sliderLY, -16000, 16000, 25, 175), 20); + circle(map(sliderLX, -16000, 16000, 175, 25), 100, 20); + + line(300, 25, 300, 175); + line(225, 100, 375, 100); + circle(300, map(sliderRY, -16000, 16000, 25, 175), 20); + circle(map(sliderRX, -16000, 16000, 375, 225), 100, 20); + + fill(fingersL[0] == 1 ? 255 : 0); + circle(40, 210, 20); + fill(fingersL[1] == 1 ? 255 : 0); + circle(80, 210, 20); + fill(fingersL[2] == 1 ? 255 : 0); + circle(120, 210, 20); + fill(fingersL[3] == 1 ? 255 : 0); + circle(160, 210, 20); + + fill(fingersR[0] == 1 ? 255 : 0); + circle(240, 210, 20); + fill(fingersR[1] == 1 ? 255 : 0); + circle(280, 210, 20); + fill(fingersR[2] == 1 ? 255 : 0); + circle(320, 210, 20); + fill(fingersR[3] == 1 ? 255 : 0); + circle(360, 210, 20); +} + +void oscEvent(OscMessage theOscMessage) { + if(theOscMessage.checkTypetag("i")){ + switch(theOscMessage.addrPattern()) { + case "/movedulation/sliderRX": + sliderRX = theOscMessage.get(0).intValue(); + break; + case "/movedulation/sliderRY": + sliderRY = theOscMessage.get(0).intValue(); + break; + case "/movedulation/sliderLX": + sliderLX = theOscMessage.get(0).intValue(); + break; + case "/movedulation/sliderLY": + sliderLY = theOscMessage.get(0).intValue(); + break; + + case "/movedulation/toggleR1": + fingersR[0] = theOscMessage.get(0).intValue(); + break; + case "/movedulation/toggleR2": + fingersR[1] = theOscMessage.get(0).intValue(); + break; + case "/movedulation/toggleR3": + fingersR[2] = theOscMessage.get(0).intValue(); + break; + case "/movedulation/toggleR4": + fingersR[3] = theOscMessage.get(0).intValue(); + break; + + case "/movedulation/toggleL1": + fingersL[0] = theOscMessage.get(0).intValue(); + break; + case "/movedulation/toggleL2": + fingersL[1] = theOscMessage.get(0).intValue(); + break; + case "/movedulation/toggleL3": + fingersL[2] = theOscMessage.get(0).intValue(); + break; + case "/movedulation/toggleL4": + fingersL[3] = theOscMessage.get(0).intValue(); + break; + } + + + } + + //if(theOscMessage.checkTypetag("i")){ + //println(" Value: "+theOscMessage); + //} + +}