As promised here is my blogpost with the final description of the Hillstar MGC3130 controlled Sparki robot.
Video
First a video showing the robot in action:
Implementation details
First I made a small trolley to carry the electrode:
Next I made proper connections between the two units:
Finally I created software by combining and adapting some demo code:
#include <Sparki.h> // include the sparki library
#include <Wire.h>
#include <Hover.h>
// Pin declarations for Hover
int ts = 0;
int reset = 1;
Hover hover = Hover();
byte event;
String output_string = "";
bool driving_forward = false;
void setup() {
delay(4000);
sparki.clearLCD();
sparki.println("Initializing Hover...please wait.");
sparki.updateLCD();
hover.begin(ts, reset);
sparki.clearLCD();
sparki.println("Ready for Gestures!.");
sparki.updateLCD();
}
void loop(void) {
// Check if Hover is ready to send gesture or touch events
if (hover.getStatus(ts) == 0) {
//Get the event over i2c and print it
event = hover.getEvent();
//This section can be commented out if you don't want to see the event in text format
output_string = hover.getEventString(event);
if (output_string != ""){
sparki.print(event);
sparki.println(" = " + output_string);
sparki.updateLCD();
}
switch(event)
{
case 40:
driving_forward = true;
break;
case 80:
sparki.moveBackward();
break;
case 36:
sparki.moveLeft();
delay(500);
sparki.moveStop();
break;
case 34:
sparki.moveRight();
delay(500);
sparki.moveStop();
break;
case 72:
sparki.gripperOpen();
break;
case 66:
sparki.gripperClose();
break;
case 68:
sparki.servo(80);
break;
case 65:
sparki.servo(-80);
break;
case 48:
driving_forward = false;
sparki.gripperStop();
sparki.servo(0);
break;
}
if (driving_forward) {
sparki.moveForward();
} else {
sparki.moveStop();
}
//Reset Hover for next event
hover.setRelease(ts);
}
}
Thanks for reading, feel free to submit comments and remarks below.




-
dubbie
-
Cancel
-
Vote Up
0
Vote Down
-
-
Sign in to reply
-
More
-
Cancel
Comment-
dubbie
-
Cancel
-
Vote Up
0
Vote Down
-
-
Sign in to reply
-
More
-
Cancel
Children