Skip to content
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

Add check for start and end of command #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
40 changes: 23 additions & 17 deletions rucicka/rucicka.ino
Original file line number Diff line number Diff line change
Expand Up @@ -203,23 +203,29 @@ void loop()
{
if(Serial.available() > 0)
{
float elbow = Serial.parseFloat();
float shoulder = Serial.parseFloat();
float wrist = Serial.parseFloat();
int z = Serial.parseInt();
int g = Serial.parseInt();
int wr = Serial.parseInt();
// Display position
//Serial.print("tmpx = "); Serial.print(tmpx, DEC); Serial.print("\ttmpy = "); Serial.print(tmpy, DEC); Serial.print("\ttmpz = "); Serial.print(tmpz, DEC); Serial.print("\ttmpg = "); Serial.print(tmpg, DEC); Serial.print("\ttmpwa = "); Serial.print(tmpwa, DEC); Serial.print("\ttmpwr = "); Serial.println(tmpwr, DEC);

// Move arm
//Arm(tmpx, tmpy, tmpz, tmpg, tmpwa, tmpwr);
move(elbow, shoulder, wrist, z, g, wr);

//delay(100);
// Pause for 100 ms between actions
lastReferenceTime = millis();
while(millis() <= (lastReferenceTime + 100)){};
if(Serial.readString() == "|")
{
float elbow = Serial.parseFloat();
float shoulder = Serial.parseFloat();
float wrist = Serial.parseFloat();
int z = Serial.parseInt();
int g = Serial.parseInt();
int wr = Serial.parseInt();
// Display position
//Serial.print("tmpx = "); Serial.print(tmpx, DEC); Serial.print("\ttmpy = "); Serial.print(tmpy, DEC); Serial.print("\ttmpz = "); Serial.print(tmpz, DEC); Serial.print("\ttmpg = "); Serial.print(tmpg, DEC); Serial.print("\ttmpwa = "); Serial.print(tmpwa, DEC); Serial.print("\ttmpwr = "); Serial.println(tmpwr, DEC);

// Move arm
//Arm(tmpx, tmpy, tmpz, tmpg, tmpwa, tmpwr);
if(Serial.readString() == "|")
{
move(elbow, shoulder, wrist, z, g, wr);

//delay(100);
// Pause for 100 ms between actions
lastReferenceTime = millis();
while(millis() <= (lastReferenceTime + 100)){};
}
}
}
//delay(1000);
}