Go Down

Topic: Esplora & Servos (Read 3313 times) previous topic - next topic

runaway_pancake

I've been experimenting with my Esplora.  I bought it when RadioShack was having its "everything must go" sale several months ago.
Looks like it's happy with the Servo.h library.  I checked it out using the "tinkerkit" connectors.
A separate supply should be used for the servo power though (the surge is taxing, a significant draw, on the V_usb deal.)

I used the "Micro servo" that I bought from RadioShack at the same time.  Its pins do not match the tinkerkit scheme, so you'll have to reconfigure the servo pins or get a couple of headers and make a transition/adapter on your breadboard to accommodate.

Code: [Select]

/* Sweep
 by BARRAGAN This example code is in the public domain.
 modified 8 Nov 2013
 by Scott Fitzgerald
*/
#include <Servo.h>
#include <Esplora.h>
 
Servo myservo;  // create servo object to control a servo 
int pos = 0;    // variable to store the servo position
 
void setup()
{
  myservo.attach(11);  // attaches the servo to pin needed, tinkerkit 3 OR 11
}
void loop()
{
  for(pos = 0; pos <= 180; pos += 1) // goes from 0 degrees to 180 degrees
  {                                  // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for(pos = 180; pos>=0; pos-=1)     // goes from 180 degrees to 0 degrees
  {                               
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}


Contrary to other renderings that you may have seen, the following definitely is THE pinout for the tinkerkit connectors. (The Gnd and +5 are oriented the same way for the "Input" connectors on the right.)

"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

goodinventor

However, there is a better way. Output to one of the outputs on the headers in the center of the board.

runaway_pancake


However, there is a better way. Output to one of the outputs on the headers in the center of the board.
"Pins is pins", they're all the same that way, but this leaves the header you mentioned free for the LCD for which it was intended (if that's important to anybody.)

I don't see the "better" aspect of your "way".
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

Go Up