I’ve got a Spark core from the Kickstarter project and have been following the progress of Spark.io ever since. I really have no idea what I’m doing, but the idea of making things I can connect to is awesome.
In that tutorial they use a Arduino Uno microcontroller to communicate with the claw/servo. I’d like to do the same, but with my core. I have no idea how XD!
I’ve fired up my core and used the android app to make things flash, that’ is about it. The next step… to start communicate written commands from the core to control electronic components is something I really have no idea where to get started.
If anyone has any good resources on what I need to read/do next in my quest to understand how to make things with my core, so that I can continue toward my goal of controlling the claw, I would greatly appreciate it.
I would suggest that the first thing you get working is simply opening and closing the claw with the Core. You can pretty much follow the Sparkfun tutorial but instead of being in the Arduino IDE you’ll be in the SparkCore IDE. Once you get it opening, closing, and anywhere in between (look into the MAP function if the tutorial doesn’t already use it) report back and we’ll go from there.
Also, what android device do you have and would you be interested in a android app to open/close the claw?
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
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>=1; 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
}
}
Thanks so much, just the direction I needed! I’ve ordered the servo and claw, as soon as it gets here I’ll see if I can get it closing and opening and report back.
The Android device I’m using is Sharp SH530. The app I used I got from the play store. An app to specifically close and open the claw would be great, especially if it was open source - I plan on adding wheels to my construction eventually, so would love to extend the app.
Your servo is going to be much happier with 5V instead of 3.3V. If you use the USB cable for power, then that is available on the core Vin pin shown here:
3V3*: This is a separate low-noise regulated 3.3V power rail designed for analog circuitry that may be susceptible to noise from the digital components. If you’re using any sensitive analog sensors, power them from 3V3* instead of from 3V3.
With regards to the Android application for opening/closing and just generally controlling the claw I would suggest you look into MIT App Inventor. I recently discovered it and have been using it to quickly develop apps for the SparkCore.