-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ошибка при подключении нескольких устройств #1
Comments
Быть может проблема в том, что не вызывается метод Спасибо за репорт. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
При подключении нескольких устройств 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: