Hi so originally I tried to write an I2C code to have my arduino to tell the uArm how to move. Now I am trying to use serial communication through the TX/RX. As of now I have a simple code that I will attach below that pretty much says if the arm receives code to move to this coordinate, then move back. Unfortunately, the arm doesn’t move in the x (or rotational) axis. It only moves forward and vertically then returns to its normal position. Can anybody tell me if it is the code or the arm?
Slave:
#include “uarm_library.h”
#include <EEPROM.h>
#include <Wire.h>
#include <Servo.h>
bool alter = false;
void setup() {
// initialize both serial ports:
Serial.begin(9600);
}
byte highiambyte;
void loop() {
if (Serial.available()) {
while(Serial.read()!=-1)
{}
if(alter)
{
uarm.moveTo(20,-10,20);
}
else
{
uarm.moveTo(20,-10,20);
}
alter != alter;
}
}
Master:
void setup() {
// initialize both serial ports:
Serial.begin(9600);
}
int i=0;
void loop() {
delay(6000);
Serial.write(i);
i=i+1;
if(i>10)
{i=0;}