thegman
15-09-2011, 18:14
Ciao a tutti!
Ho seguito varie guide per far comunicare il mio iPod Touch 4G con l'ambiente di programmazione Processing (per poi utilizzare arduino) ma quando faccio partire ii vari programmi Processing non riceve alcun segnale da TouchOSCEditor.
In Touch OSC ho settato le porte in entrata 8000 e in uscita 9000.
E questo è il codice che utilizzo in processing:
// import oscP5 libraries and Arduino serial libraries
import oscP5.*;
import netP5.*;
import processing.serial.*;
import cc.arduino.*;
// make a new Arduino object
Arduino arduino;
// make a new oscP5 object
OscP5 oscP5;
// setup the value for the button
float v_toggle1 = 0.0f;
// run the setup loop
void setup() {
// configure the screen size and frame rate
size(200,200);
frameRate(30);
// start oscP5, listening for incoming messages at port 8000
// if your outgoing port on TouchOSC is not 8000, edit it here
oscP5 = new OscP5(this,8000);
// establish a serial connection with the Arduino at 57600 baud
// this will use the first listing in the serial list, change if necessary
arduino = new Arduino(this,Serial.list()[0],57600);
// setup Arduino pin 13 as output
arduino.pinMode(13, Arduino.OUTPUT);
}
// when OSC packets are received
void oscEvent(OscMessage theOscMessage) {
// set the current address to the control name
String addr = theOscMessage.addrPattern();
// get the value of the control
float val = theOscMessage.get(0).floatValue();
// if the control toggled is toggle1, then toggle float value
if(addr.equals("/1/toggle1")) { v_toggle1 = val; }
}
// the program loop
void draw() {
// if toggle = off, then make black background
// if toggle = on, then make orange background
if ((int) v_toggle1 == 0){
background(0);
} else {
background(255, 165, 0);
}
// write the int value of toggle button to pin 13 on Arduino
arduino.digitalWrite(13, (int) v_toggle1);
delay(500);
// print the status in serial debugger
println(v_toggle1);
}
possono essere le porte di windows?(ho provato sia con 7 che con xp)
o è possibile che i due programmi non comunichino fra loro? cosa posso fare per escludere questo problema?
Ho seguito varie guide per far comunicare il mio iPod Touch 4G con l'ambiente di programmazione Processing (per poi utilizzare arduino) ma quando faccio partire ii vari programmi Processing non riceve alcun segnale da TouchOSCEditor.
In Touch OSC ho settato le porte in entrata 8000 e in uscita 9000.
E questo è il codice che utilizzo in processing:
// import oscP5 libraries and Arduino serial libraries
import oscP5.*;
import netP5.*;
import processing.serial.*;
import cc.arduino.*;
// make a new Arduino object
Arduino arduino;
// make a new oscP5 object
OscP5 oscP5;
// setup the value for the button
float v_toggle1 = 0.0f;
// run the setup loop
void setup() {
// configure the screen size and frame rate
size(200,200);
frameRate(30);
// start oscP5, listening for incoming messages at port 8000
// if your outgoing port on TouchOSC is not 8000, edit it here
oscP5 = new OscP5(this,8000);
// establish a serial connection with the Arduino at 57600 baud
// this will use the first listing in the serial list, change if necessary
arduino = new Arduino(this,Serial.list()[0],57600);
// setup Arduino pin 13 as output
arduino.pinMode(13, Arduino.OUTPUT);
}
// when OSC packets are received
void oscEvent(OscMessage theOscMessage) {
// set the current address to the control name
String addr = theOscMessage.addrPattern();
// get the value of the control
float val = theOscMessage.get(0).floatValue();
// if the control toggled is toggle1, then toggle float value
if(addr.equals("/1/toggle1")) { v_toggle1 = val; }
}
// the program loop
void draw() {
// if toggle = off, then make black background
// if toggle = on, then make orange background
if ((int) v_toggle1 == 0){
background(0);
} else {
background(255, 165, 0);
}
// write the int value of toggle button to pin 13 on Arduino
arduino.digitalWrite(13, (int) v_toggle1);
delay(500);
// print the status in serial debugger
println(v_toggle1);
}
possono essere le porte di windows?(ho provato sia con 7 che con xp)
o è possibile che i due programmi non comunichino fra loro? cosa posso fare per escludere questo problema?