Loading...
  Show Posts
Pages: 1 2 3 [4] 5 6 ... 14
46  Products / Arduino Esplora / Joystick on Esplora help on: March 01, 2013, 05:37:05 am
How do I write code so that when I push the joystick up and left at about 45 degrees, the robot turns left forward? Push the joystick up and right at about 45 degrees, the robot turns right forward. Push the joystick down and right at about 45 degrees, the robot turns right backward. Push the joystick down and left at about 45 degrees, the robot turns left backward.

Code:
if (joystick is up and joystick is left at about 45 degrees)
{
  robot turns left forward
}
if (joystick is up and joystick is right at about 45 degrees)
{
  robot turns right forward
}
if (joystick is down and joystick is left at about 45 degrees)
{
  robot turns left backward
}
if (joystick is down and joystick is right at about 45 degrees)
{
  robot turns right backward
}
47  Using Arduino / Programming Questions / Esplora setup loop problem? on: February 28, 2013, 09:08:29 pm
I'm trying to write code that lets me use Esplora board to control a robot. When I start the code, it is supposed to set up the servos to center position but nothing happens until I press the joystick button. How can I fix the problem?

Code:
#include <Esplora.h>
int walkflag;
void setup()
{
  Serial1.begin(115200);
  if (Serial1.available())
  {
    robotstand01; < nothing happens here
    delay(500);
  }  
}
void loop()
{
  if(Esplora.readJoystickButton()==LOW)
  {
    walkflag = 0;
    robotstand01(); < it works.
  }  
  if(Esplora.readButton(JOYSTICK_UP)==LOW)
  {
    walkflag = 1;
    robotwalk01();
    robotwalk02();
    robotwalk03();
    robotwalk04();
    robotwalk05();
    robotwalk06();
    robotwalk07();
    robotwalk08();
    robotwalk09();
  }  
  //if(Esplora.readButton(JOYSTICK_DOWN)==LOW)
  //{
    //robotwalk01();
    //delay(1000);
    //robotwalk02();
    //delay(1000);
    //robotwalk03();
    //delay(1000);
    //robotwalk04();
    //delay(1000);
    //robotwalk05();
    //delay(1000);
    //robotwalk06();
    //delay(1000);
  //}  
}  
void robotstand01()
{
  Serial1.print("#0 P1500 T500 \r ");
  Serial1.print("#1 P1500 T500 \r ");
  Serial1.print("#2 P1500 T500 \r ");
  Serial1.print("#4 P1500 T500 \r ");
  Serial1.print("#5 P1500 T500 \r ");
  Serial1.print("#6 P1500 T500 \r ");
  Serial1.print("#8 P1500 T500 \r ");
  Serial1.print("#9 P1500 T500 \r ");
  Serial1.print("#10 P1500 T500 \r ");
  Serial1.print("#16 P1500 T500 \r ");
  Serial1.print("#17 P1500 T500 \r ");
  Serial1.print("#18 P1500 T500 \r ");
  Serial1.print("#20 P1500 T500 \r ");
  Serial1.print("#21 P1500 T500 \r ");
  Serial1.print("#22 P1500 T500 \r ");
  Serial1.print("#24 P1500 T500 \r ");
  Serial1.print("#25 P1500 T500 \r ");
  Serial1.print("#26 P1500 T500 \r ");
  delay(500);
}
void robotwalk01()
{
  Serial1.print("#0 P1500 T500 \r ");
  Serial1.print("#1 P1667 T500 \r ");
  Serial1.print("#2 P1667 T500 \r ");
  Serial1.print("#4 P1500 T500 \r ");
  Serial1.print("#5 P1500 T500 \r ");
  Serial1.print("#6 P1500 T500 \r ");
  Serial1.print("#8 P1500 T500 \r ");
  Serial1.print("#9 P1667 T500 \r ");
  Serial1.print("#10 P1667 T500 \r ");
  Serial1.print("#16 P1500 T500 \r ");
  Serial1.print("#17 P1500 T500 \r ");
  Serial1.print("#18 P1500 T500 \r ");
  Serial1.print("#20 P1500 T500 \r ");
  Serial1.print("#21 P1667 T500 \r ");
  Serial1.print("#22 P1667 T500 \r ");
  Serial1.print("#24 P1500 T500 \r ");
  Serial1.print("#25 P1500 T500 \r ");
  Serial1.print("#26 P1500 T500 \r ");
  delay(500);
}
<rest of code>
48  Using Arduino / Programming Questions / Execute subroutine/function once? on: February 19, 2013, 08:50:37 pm
Code:
#include <Esplora.h>
int standwalk = 0;
void setup()
{
  Serial1.begin(9600);
  robotstand01();
}
void loop()
{
  if(Esplora.readButton(JOYSTICK_UP)==LOW)
  {
    //robotstandtowalk01();
    //delay(1000);
    robotwalk01();
    delay(1000);
    robotwalk02();
    delay(1000);
    robotwalk03();
    delay(1000);
    robotwalk04();
    delay(1000);
    robotwalk05();
    delay(1000);
    robotwalk06();
    delay(1000);
  } 
  if(Esplora.readButton(JOYSTICK_DOWN)==LOW)
  {
    robotwalk01();
    delay(1000);
    robotwalk02();
    delay(1000);
    robotwalk03();
    delay(1000);
    robotwalk04();
    delay(1000);
    robotwalk05();
    delay(1000);
    robotwalk06();
    delay(1000);
  } 
}
void move(int servo, int position, int time)
{
  Serial1.print("#");
  Serial1.print(servo);
  Serial1.print(" P");
  Serial1.print(position);
  Serial1.print(" T");
  Serial1.println(time);
}
void robotstand01()
{
  move(0,1500,1000);
  move(1,1500,1000);
  move(2,1500,1000);
  move(3,1500,1000);
  move(4,1500,1000);
  move(5,1500,1000);
  move(16,1500,1000);
  move(17,1500,1000);
  move(18,1500,1000);
  move(19,1500,1000);
  move(20,1500,1000);
  move(21,1500,1000);
}
void robotstandtowalk01()
{
  move(0,1500,1000);
  move(1,1667,1000);
  move(2,1500,1000);
  move(3,1500,1000);
  move(4,1500,1000);
  move(5,1667,1000);
  move(16,1500,1000);
  move(17,1500,1000);
  move(18,1500,1000);
  move(19,1667,1000);
  move(20,1500,1000);
  move(21,1500,1000);
}

void robotwalk01()
{
  move(0,1167,1000);
  move(1,1667,1000);
  move(2,1833,1000);
  move(3,1500,1000);
  move(4,1167,1000);
  move(5,1667,1000);
  move(16,1167,1000);
  move(17,1500,1000);
  move(18,1833,1000);
  move(19,1667,1000);
  move(20,1167,1000);
  move(21,1500,1000);
}
void robotwalk02()
{
  move(0,1167,1000);
  move(1,1500,1000);
  move(2,1833,1000);
  move(3,1500,1000);
  move(4,1167,1000);
  move(5,1500,1000);
  move(16,1167,1000);
  move(17,1500,1000);
  move(18,1833,1000);
  move(19,1500,1000);
  move(20,1167,1000);
  move(21,1500,1000);
}
void robotwalk03()
{
  move(0,1167,1000);
  move(1,1500,1000);
  move(2,1833,1000);
  move(3,1667,1000);
  move(4,1167,1000);
  move(5,1500,1000);
  move(16,1167,1000);
  move(17,1667,1000);
  move(18,1833,1000);
  move(19,1500,1000);
  move(20,1167,1000);
  move(21,1667,1000);
}
void robotwalk04()
{
  move(0,1833,1000);
  move(1,1500,1000);
  move(2,1167,1000);
  move(3,1667,1000);
  move(4,1833,1000);
  move(5,1500,1000);
  move(16,1833,1000);
  move(17,1667,1000);
  move(18,1167,1000);
  move(19,1500,1000);
  move(20,1833,1000);
  move(21,1667,1000);
}
void robotwalk05()
{
  move(0,1833,1000);
  move(1,1500,1000);
  move(2,1167,1000);
  move(3,1500,1000);
  move(4,1833,1000);
  move(5,1500,1000);
  move(16,1833,1000);
  move(17,1500,1000);
  move(18,1167,1000);
  move(19,1500,1000);
  move(20,1833,1000);
  move(21,1500,1000);
}
void robotwalk06()
{
  move(0,1833,1000);
  move(1,1667,1000);
  move(2,1167,1000);
  move(3,1500,1000);
  move(4,1833,1000);
  move(5,1667,1000);
  move(16,1833,1000);
  move(17,1500,1000);
  move(18,1167,1000);
  move(19,1667,1000);
  move(20,1833,1000);
  move(21,1500,1000);
}

How do I have robotstandtowalk01() subroutine/function execute once? Is it possible to use the code in BlinkWithoutDelay sketch instead of Delay(1000)?
49  Using Arduino / Programming Questions / Arduino Esplora and Lynxmotion SSC-32 help on: February 18, 2013, 03:59:55 pm
I connected Arduino Esplora to SSC-32 board made by Lynxmotion. I can use the thumbstick to move my robot. I think that there's a problem with the Arduino code. If I comment out the else parts of the code, the robot walks correctly. If I don't comment out the else parts of the code, there is a slight pause in the walking movement. How can I fix the problem?

Code:
#include <Esplora.h>
void setup()
{
  Serial1.begin(9600);
  robotstand01();
}
void loop()
{
  if(Esplora.readButton(JOYSTICK_UP)==LOW)
  {
    robotwalk01();
    delay(1000);
    robotwalk02();
    delay(1000);
    robotwalk03();
    delay(1000);
    robotwalk04();
    delay(1000);
    robotwalk05();
    delay(1000);
    robotwalk06();
    delay(1000);
  }  
  //else
  //{
  //  robotstand01();
  //  delay(1000);
  //}
  //delay(50);
  if(Esplora.readButton(JOYSTICK_DOWN)==LOW)
  {
    robotwalk01();
    delay(1000);
    robotwalk02();
    delay(1000);
    robotwalk03();
    delay(1000);
    robotwalk04();
    delay(1000);
    robotwalk05();
    delay(1000);
    robotwalk06();
    delay(1000);
  }  
  //else
  //{
  //  robotstand01();
  //  delay(1000);
  //}
  //delay(50);
  if(Esplora.readButton(JOYSTICK_UP)==LOW || Esplora.readButton(JOYSTICK_DOWN)==LOW)
  {
    robotstand01();
    delay(1000);
  }
}
void move(int servo, int position, int time)
{
  Serial1.print("#");
  Serial1.print(servo);
  Serial1.print(" P");
  Serial1.print(position);
  Serial1.print(" T");
  Serial1.println(time);
}
void robotstand01()
{
  move(0,1500,1000);
  move(1,1500,1000);
  move(2,1500,1000);
  move(3,1500,1000);
  move(4,1500,1000);
  move(5,1500,1000);
  move(16,1500,1000);
  move(17,1500,1000);
  move(18,1500,1000);
  move(19,1500,1000);
  move(20,1500,1000);
  move(21,1500,1000);
}
void robotwalk01()
{
  move(0,1167,1000);
  move(1,1667,1000);
  move(2,1833,1000);
  move(3,1500,1000);
  move(4,1167,1000);
  move(5,1667,1000);
  move(16,1167,1000);
  move(17,1500,1000);
  move(18,1833,1000);
  move(19,1667,1000);
  move(20,1167,1000);
  move(21,1500,1000);
}
void robotwalk02()
{
  move(0,1167,1000);
  move(1,1500,1000);
  move(2,1833,1000);
  move(3,1500,1000);
  move(4,1167,1000);
  move(5,1500,1000);
  move(16,1167,1000);
  move(17,1500,1000);
  move(18,1833,1000);
  move(19,1500,1000);
  move(20,1167,1000);
  move(21,1500,1000);
}
void robotwalk03()
{
  move(0,1167,1000);
  move(1,1500,1000);
  move(2,1833,1000);
  move(3,1667,1000);
  move(4,1167,1000);
  move(5,1500,1000);
  move(16,1167,1000);
  move(17,1667,1000);
  move(18,1833,1000);
  move(19,1500,1000);
  move(20,1167,1000);
  move(21,1667,1000);
}
void robotwalk04()
{
  move(0,1833,1000);
  move(1,1500,1000);
  move(2,1167,1000);
  move(3,1667,1000);
  move(4,1833,1000);
  move(5,1500,1000);
  move(16,1833,1000);
  move(17,1667,1000);
  move(18,1167,1000);
  move(19,1500,1000);
  move(20,1833,1000);
  move(21,1667,1000);
}
void robotwalk05()
{
  move(0,1833,1000);
  move(1,1500,1000);
  move(2,1167,1000);
  move(3,1500,1000);
  move(4,1833,1000);
  move(5,1500,1000);
  move(16,1833,1000);
  move(17,1500,1000);
  move(18,1167,1000);
  move(19,1500,1000);
  move(20,1833,1000);
  move(21,1500,1000);
}
void robotwalk06()
{
  move(0,1833,1000);
  move(1,1667,1000);
  move(2,1167,1000);
  move(3,1500,1000);
  move(4,1833,1000);
  move(5,1667,1000);
  move(16,1833,1000);
  move(17,1500,1000);
  move(18,1167,1000);
  move(19,1667,1000);
  move(20,1833,1000);
  move(21,1500,1000);
}

50  Using Arduino / Project Guidance / Re: Creating A Remote E-Stop for Epilog Laser Cutter using SSR on: February 18, 2013, 03:36:36 pm
Does the machine have E-Stop button that requires you to turn the button to reset the machine? If so, I think that Arduino and relay will not work. Why not get another E-Stop button?
51  Topics / Robotics / Re: Programs for creating 3D models of robots before building them? on: February 07, 2013, 05:46:26 am
I tried to build a prototype of a robot but I ran out of parts and I didn't make plans for the robot.
52  Topics / Robotics / Re: Low cost Robot Hand (with only one motor) on: February 07, 2013, 05:44:08 am
What size of garden hose did you use in the low-cost robot hand?
53  Using Arduino / Project Guidance / Re: Will this setup cause a fire? on: February 06, 2013, 05:43:29 am
David82, I think that you should STOP trying to do something that may cause injury or death, and may cause damage to property. You CAN'T try to run 120VAC current through Cat5 cables. If you don't believe me, connect two thin wires to a powerful battery (battery pack for R/C cars). Touch the wires together and watch the insulation melt.
54  Topics / Robotics / Re: Programs for creating 3D models of robots before building them? on: February 06, 2013, 05:33:57 am
I want to create a mechanically correct model and simulate it to make sure that it works before building it. I don't have a lot of money for software.
55  Using Arduino / Programming Questions / Re: Arduino Joystick Coding on: February 05, 2013, 09:08:19 pm
stevekap25, Does the go-cart have pedals for throttle and brakes? If so, you can add a "joystick" connected to the pedals. The linkages between the "joystick" and pedals would be made so that when the client pushes the "joystick" forward, the linkage would push the throttle pedal forward, making the go-cart run. When the client pulls the "joystick" backward, the linkage would push the brake pedal forward, stopping the go-cart. The linkage would have sliding joints so that one pedal is pushed forward at a time.
56  Using Arduino / Programming Questions / Re: Arduino Joystick Coding on: February 05, 2013, 06:03:31 am
stevekap25, Does the go-cart have automotive-type steering? If so, can your client use the steering wheel and use the joystick for throttle and brakes?
57  Topics / Robotics / Re: Programs for creating 3D models of robots before building them? on: February 04, 2013, 06:13:09 am
I am trying to create a functional model before building the robot.
58  Topics / Robotics / Re: Programs for creating 3D models of robots before building them? on: February 03, 2013, 06:47:45 am
What about 3D modeling programs such as 3D Studio MAX and 3D game engines such as Unity 3D, CryEngine, and UDK? I tried to use Microsoft Robot Studio and V-Rep Pro (http://coppeliarobotics.com/) but I don't know how to use them.
59  Topics / Robotics / Programs for creating 3D models of robots before building them? on: February 02, 2013, 08:53:44 pm
Are there programs for creating 3D models of robots before building them?
60  Products / Arduino Esplora / Using accelerometer to control computer games? on: January 29, 2013, 08:53:28 pm
How do I use the accelerometer in Arduino Esplora to control computer games as if the Arduino Esplora is a tablet? I controlled a game on a tablet by tilting the tablet.
Pages: 1 2 3 [4] 5 6 ... 14