Hi, I need your help !!! ... I'm trying to send data from C # to arduino but it still fails, try to send a float that has values between 0 and 0.5 to generate evidence when the value is greater than 0.3 light a led as it is less off, but the LED lights to generate communication and never goes out ... Help !!!
Arduino code:
int val;
float xVal;
void setup(){
Serial.begin(9600);
pinMode(13,OUTPUT);
}
void loop(){
if(Serial.available() > 1){
val = Serial.read();
if(val=='s'){
xVal=Serial.read();
Serial.print(xVal);
if(xVal > 0.3){
digitalWrite(13, HIGH);
}else{
digitalWrite(13, LOW);
}
delay(500);
}
}
}
C# code (only comunication)
Joint manoD = esqueleto.Joints[JointType.HandRight];
Joint codoD = esqueleto.Joints[JointType.ElbowRight];
SkeletonPoint posicionMano = manoD.Position;
float angX = posicionMano.X;
string a = angX.ToString();
port.Write("s");
port.Write(a);
mensaje = string.Format("X{0}",posicionMano.X);
mensaje shows the position value is the float Mano.X I try and send me good screen shows the values but not the arduino reads well: S