You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
При подключении нескольких устройств URM37 на одном из устройств(последнее проинициализированное устройство будет работать) при чтении появляется ошибка timeout.
ide: arduino 1.0, на старых версиях 2 urm37 работали нормально.
int getMeasurement(URMSerial urm)
{
switch(urm.requestMeasurementOrTimeout(DISTANCE, value)) // Find out the type of request
{
case DISTANCE: // Double check the reading we recieve is of DISTANCE type
return value;
break;
case TEMPERATURE:
return value;
break;
case ERROR:
Serial.println("Error");
break;
case NOTREADY:
Serial.println("Not Ready");
break;
case TIMEOUT:
Serial.println("Timeout");
break;
}
return -1;
}
{/code}
The text was updated successfully, but these errors were encountered:
При подключении нескольких устройств URM37 на одном из устройств(последнее проинициализированное устройство будет работать) при чтении появляется ошибка timeout.
ide: arduino 1.0, на старых версиях 2 urm37 работали нормально.
Скетч
{code}
include <SoftwareSerial.h>
include <URMSerial.h>
// LEFT sensor
define URM_LEFT_TXD_PIN 11
define URM_LEFT_RXD_PIN 10
// Right sensor
define URM_RIGHT_TXD_PIN 8
define URM_RIGHT_RXD_PIN 9
URMSerial urmLeft;
URMSerial urmRight;
int value; // This value will be populated
void setup()
{
delay(100);
Serial.begin(9600); // Sets the baud rate to 9600
urmLeft.begin(URM_RIGHT_TXD_PIN, URM_RIGHT_RXD_PIN,9600); // TX Pin, RX Pin, Baud
delay(100);
urmRight.begin(URM_LEFT_TXD_PIN, URM_LEFT_RXD_PIN,9600); // RX Pin, TX Pin, Baud Rate
}
void loop()
{
delay(500);
Serial.print("Measurement left: ");
Serial.println(getMeasurement(urmLeft));
Serial.print("Measurement right: ");
Serial.println(getMeasurement(urmRight));
}
int getMeasurement(URMSerial urm)
{
switch(urm.requestMeasurementOrTimeout(DISTANCE, value)) // Find out the type of request
{
case DISTANCE: // Double check the reading we recieve is of DISTANCE type
return value;
break;
case TEMPERATURE:
return value;
break;
case ERROR:
Serial.println("Error");
break;
case NOTREADY:
Serial.println("Not Ready");
break;
case TIMEOUT:
Serial.println("Timeout");
break;
}
}
{/code}
The text was updated successfully, but these errors were encountered: