hi
i'm new on arduino and programming...
to get sensor on Max/msp with an ethernet shield i used Z_osc. for get value in good type i have convert long to string (to have value between 0/1023).
but max interpreted a string like a symbol = /sensor "422" and i have to remove the " " for each input adress.
is there a way to have value between 0/1023 without the " " .
below the code i used
thanks for your help
0-0
#include <SPI.h>
#include <Ethernet.h>
#include <Z_OSC.h>
byte myMac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x32, 0x78 };
byte myIp[] = { 192, 168, 0, 255 };
byte destIp[] = { 192, 168, 0, 5 }; //IP ordi
int destPort = 10000; //port receive
char oscAdr[] = "/sensor";
int sensorPin = A0;
int sensorValue = 0;
char bufPin0[5];
Z_OSCClient client;
void setup(){
Ethernet.begin(myMac ,myIp);
}
void loop(){
sendProcess();
Z_OSCMessage mes;
mes.setAddress(destIp,destPort);
client.send(&mes);
mes.flush();
delay(10);
}
void sendProcess(){
int tmp= (int) sensorValue;
Z_OSCMessage message;
message.setAddress(destIp,destPort);
message.setZ_OSCMessage(oscAdr ,"s" ,&bufPin0 );
client.send(&message);
sensorValue = analogRead (sensorPin);
itoa (sensorValue-0, bufPin0, 10); //convert long into string
}