Show Posts
Pages: [1]
1  Products / Arduino Esplora / Re: Interfacing an Esplora to an Xbee on: January 01, 2013, 05:53:37 pm
I was thinking of trying this http://www.liquidware.com/shop/show/MBP/Lithium+Backpack
2  Products / Arduino Esplora / Re: Interfacing an Esplora to an Xbee on: December 31, 2012, 05:09:01 pm
Stick a battery on it, have it communicate with an Uno with a motor controller and you got yourself an RC car. Good job.
3  Products / Arduino Esplora / Re: Radio Shack now has the Esplora on: December 27, 2012, 06:42:52 pm
That's where I got mine. It seems to not have standard inputs and outputs mapped out like other arduino boards, I'm trying to figure out how to use the tinkerkit leads to add functionality.  The LCD expansion ports may also be useful but i haven't gotten that far yet.  You may be able to use the ICSP leads for a battery pack.

EDIT:
Made a map:
4  Products / Arduino Esplora / Re: Stopping the mouse program example? on: December 27, 2012, 05:12:58 pm
For some reason by default my joystick is at x-8 y-1 while in center and when I run this example my mouse is constantly moving up and to the right.  Is there a way to calibrate the joystick to zero?

I've worked around it by modifying the code:
Code:
 int xValue = Esplora.readJoystickX()+8;        // read the joystick's X position
  int yValue = Esplora.readJoystickY()+1;        // read the joystick's Y position

I've now added functionality for this and fixed this problem:
Code:
#include <Esplora.h>

int initx,inity;                                 //declares global variables for inital x/y values

void setup()
{
  Serial.begin(9600);                            // initialize serial communication with your computer
  Mouse.begin();                                 // take control of the mouse
  initx = Esplora.readJoystickX();               //read initial value for x
  inity = Esplora.readJoystickY();               //read initial value for y
}

void loop()
{
  int xValue = Esplora.readJoystickX() - initx;  // read the joystick's X position - initial value
  int yValue = Esplora.readJoystickY() - inity;  // read the joystick's Y position - initial value
  int button = Esplora.readJoystickSwitch();     // read the joystick pushbutton
  int sw1 = Esplora.readButton(SWITCH_DOWN);     // read switch 1 state
  int sw4 = Esplora.readButton(SWITCH_RIGHT);    // read switch 4 state
  Serial.print("Joystick X: ");                  // print a label for the X value
  Serial.print(xValue);                          // print the X value
  Serial.print("\tY: ");                         // print a tab character and a label for the Y value
  Serial.print(yValue);                          // print the Y value
  Serial.print("\tStick Button: ");              // print a tab character and a label for the button
  Serial.print(button);                          // print the button value
  Serial.println();                              // create a new line
  Serial.print("Switch 1: ");                    // print a label for switch 1 value
  Serial.print(sw1);                             // print the switch 1 value
  Serial.print("\tSwitch 4: ");                  // print a tab character and a label for switch 4 value
  Serial.print(sw4);                             // print the switch 4 value
  Serial.println();                              // create a new line
  
  int mouseX = map( xValue,-512, 512, 10, -10);  // map the X value to a range of movement for the mouse X
  int mouseY = map( yValue,-512, 512, -10, 10);  // map the Y value to a range of movement for the mouse Y
  
  if((Esplora.readButton(SWITCH_DOWN) == LOW)  
      || (Esplora.readJoystickButton() == LOW)){  // checks to see if switch 1 or joystick button is pressed
    Mouse.press(MOUSE_LEFT);                     // holds down left mouse button
  }
  else{
    Mouse.release(MOUSE_LEFT);                   // releases left mouse button when not pressed
  }
  
  if(Esplora.readButton(SWITCH_RIGHT) == LOW){   // checks to see if switch 4 is pressed
  Mouse.press(MOUSE_RIGHT);                      // holds down right mouse button
  }
  else{
    Mouse.release(MOUSE_RIGHT);                  // releases right mouse button when not pressed
  }
  
  Mouse.move(mouseX, mouseY, 0);                 // move the mouse
  
  delay(10);                                     // a short delay before moving again
}
Pages: [1]