Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions examples/Testing_communications/Testing_communications.ino

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* This example allows a user to test if communication
* can be established with a motor which can be selected
* via inputting the desired number in the serial monitor.
*/

#include <Braccio++.h>

void setup()
{
Serial.begin(115200);
while(!Serial) { }

Braccio.begin();
Serial.println("Testing motor communication!");
Serial.println("Choose motor 1 to 6 to test the connection");
Serial.print(">> ");
}

void loop()
{
while(Serial.available() <= 0) { }
int const motorID = Serial.parseInt();
while(Serial.read() != '\n') { }

if (motorID < 1 || motorID > 6) {
Serial.println("Error, wrong motor id, choose value between 1 and 6");
Serial.print(">> ");
return;
}

if (Braccio.connected(motorID))
Serial.println("Communication with motor " + String(motorID) + " successful");
else
Serial.println("Communication failure - Please check the motor " + String(motorID) + " connection");

Serial.print(">> ");
}