04-28-2015 09:55 PM
04-28-2015 09:56 PM
Get rid of the Filtro command where you write to the serial port and read. Then see how it works.
Did you try what I said earlier about only trying one command at a time in the loop to see how that works? That would make it obvious if a command works, or if it is broken like your Filtro command seems like it would be.
There is nothing about those timer functions that would slow your code other than, like Dennis says, it is convoluted. Also, what happened to your command letters? They look different in these images than you had earlier. You had upper case T, now you have lower case "t". Same with H vs. h. You never had "b" before. Did you had that condition to your arduino code? Because your earlier Ard. code didn't have a case for "b".
It seems like you are changing too many things in ways that just don't make sense.
04-28-2015 09:58 PM
Do you have any idea what could be the problem in Ard. code? because I run it and it works fine looking in Ard. serial.
This is my Ard. code for printing 😕
void loop() {
readLocation();
while(Serial.available())
{
in =(byte)Serial.read() ;
if(in == 't'){
temp = dht.readTemperature();
Serial.println(temp);
}
else if(in == 'h'){
hum = dht.readHumidity();
Serial.println(hum);
}
else if(in == 'b'){
Serial.println(50);
}
else if(in == 'a'){
Serial.println(alture,6);
}
else if(in=='l')
{
Serial.println(latitude,6);
}
else if(in == 'o'){
Serial.println(longitude,6);
}
else if(in == 'p'){
digitalWrite(solenoide1, LOW);
digitalWrite(solenoide2, LOW);
}
else if(in == 's'){
digitalWrite(solenoide1, HIGH);
digitalWrite(solenoide2, LOW);
}
else if(in == 't'){
digitalWrite(solenoide1, LOW);
digitalWrite(solenoide2, HIGH);
}
}
04-28-2015 10:06 PM
Try each of your commands by itself in a loop.
The ones that are correct should run fast. The ones that are wrong will run slow and/or give you errors.
That will give you a clue where to look in your C code.
Lookiing at your latest code, I see you have lower case 't' twice.
If your character you send does not match anything in your If ElseIF C code, then nothing gets returned. The VISA Read will timeout no matter how many bytes you read.
04-29-2015 06:04 PM - edited 04-29-2015 06:25 PM
I correct the code my friend in Ard. now it works fine, i was trying to send this data trought XBEE but i doesn't works, do you know if I have to change anything in my LabView code? I have configured the Xbee to receive and send, but i doesn't works, i believe that it's because xbee works with 8 data bits.
04-29-2015 06:33 PM
04-29-2015 06:39 PM
When I work connecting Ard. directly to USB it works fine, but if I use xbee I get random values, do you know if i have to change something in my VI? Or why it's happen?
10-07-2015 08:58 PM
Hola Buenas noches.. Tengo tu mismo problema, no se si ya tienes la solucion.. mucho agradecere.. Saludos
10-07-2015 09:23 PM
buenas noches
podrias ayudarme con el diagrama completo
Saludos