Problem with write(double) is ambiguous for connection with SC3

Hi,

I try to connect supercollider with Arduino but I have problems with the Arduino code, I´m going to put some push buttons and faders; I have problem when I verify the code in Arduino, my code is:

void setup(){
Serial.begin(19200);

for(int i=2; i<=13; i++){
pinMode(i, INPUT);
}
}

void loop(){

Serial.write(255);
delay(5);

Serial.write((analogRead(0)/4)*0.99);
delay(5);
Serial.write((analogRead(1)/4)*0.99);
delay(5);
Serial.write((analogRead(2)/4)*0.99);
delay(5);
Serial.write((analogRead(3)/4)*0.99);
delay(5);

Serial.write(digitalRead(2));
delay(5);
Serial.write(digitalRead(3));
delay(5);
Serial.write(digitalRead(4));
delay(5);
Serial.write(digitalRead(5));
delay(5);
Serial.write(digitalRead(6));
delay(5);
Serial.write(digitalRead(7));
delay(5);
Serial.write(digitalRead(8));
delay(5);
Serial.write(digitalRead(9));
delay(5);
Serial.write(digitalRead(10));
delay(5);

}

and I have this error: call of overloaded ‘write(double)’ is ambiguous

ControladorSC3:22: error: call of overloaded ‘write(double)’ is ambiguous
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.h:62: note: candidates are: virtual size_t HardwareSerial::write(uint8_t)
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.h:63: note: size_t HardwareSerial::write(long unsigned int)
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.h:64: note: size_t HardwareSerial::write(long int)
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.h:65: note: size_t HardwareSerial::write(unsigned int)
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.h:66: note: size_t HardwareSerial::write(int)

Hi,

I try to connect supercollider with Arduino but I have problems with the Arduino code, I´m going to put some push buttons and faders; I have problem when I verify the code in Arduino, my code is:

void setup(){
Serial.begin(19200);

for(int i=2; i<=13; i++){
pinMode(i, INPUT);
}
}

void loop(){

Serial.write(255);
delay(5);

Serial.write((analogRead(0)/4)*0.99);
delay(5);
Serial.write((analogRead(1)/4)*0.99);
delay(5);
Serial.write((analogRead(2)/4)*0.99);
delay(5);
Serial.write((analogRead(3)/4)*0.99);
delay(5);

Serial.write(digitalRead(2));
delay(5);
Serial.write(digitalRead(3));
delay(5);
Serial.write(digitalRead(4));
delay(5);
Serial.write(digitalRead(5));
delay(5);
Serial.write(digitalRead(6));
delay(5);
Serial.write(digitalRead(7));
delay(5);
Serial.write(digitalRead(8));
delay(5);
Serial.write(digitalRead(9));
delay(5);
Serial.write(digitalRead(10));
delay(5);

}

and I have this error: call of overloaded ‘write(double)’ is ambiguous

ControladorSC3:22: error: call of overloaded ‘write(double)’ is ambiguous
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.h:62: note: candidates are: virtual size_t HardwareSerial::write(uint8_t)
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.h:63: note: size_t HardwareSerial::write(long unsigned int)
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.h:64: note: size_t HardwareSerial::write(long int)
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.h:65: note: size_t HardwareSerial::write(unsigned int)
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/HardwareSerial.h:66: note: size_t HardwareSerial::write(int)

Use Serial.print() instead. The write() has no version for parameter double.

Budvar10: Use Serial.print() instead. The write() has no version for parameter double.

Or cast the result of the float operations to int.

Are you trying to send binary data or strings? Looks like binary data to me, so using print will not work.

Do not cross-post. Threads merged.

Ha, I thought my first post was lost somehow so I have sent it again. :) Duplicity from me removed.

Hi!
I converted the float to int and compile ok, but now, the problems is when open de serial monitor appears something wire, only symbols, and when I press a push button everything goes down (crash), sometimes even my computer.
Cheers!!!

float a;
float b;
float c;
float d;

void setup(){
Serial.begin(19200);

for(int i=2; i<=13; i++){
pinMode(i, INPUT);
}
}

void loop(){
a = (analogRead(0)/4)*0.99;
b = (analogRead(1)/4)*0.99;
c = (analogRead(2)/4)*0.99;
d = (analogRead(3)/4)*0.99;

Serial.write(255);
delay(5);

Serial.print((int)a);
delay(5);
Serial.print((int)b);
delay(5);
Serial.print((int)c);
delay(5);
Serial.print((int)d);
delay(5);

Serial.print(digitalRead(2));
delay(5);
Serial.print(digitalRead(3));
delay(5);
Serial.print(digitalRead(4));
delay(5);
Serial.print(digitalRead(5));
delay(5);
Serial.print(digitalRead(6));
delay(5);
Serial.print(digitalRead(7));
delay(5);
Serial.print(digitalRead(8));
delay(5);
Serial.print(digitalRead(9));
delay(5);
Serial.print(digitalRead(10));
delay(5);

}

try Serial.print(digitalRead(2), DEC); and that for all 10 in a simple loop

for (int pin=2; pin <=10; pin++) 
{
  Serial.print(digitalRead(pin), DEC);
  delay(5);
}