Demo Sketch for Hexy


#1

Just finished building my Hexy and works fine with PoCoMo though servos Jitter a fair amount.
I am wondering if anyone has any Arduino sketches they’d be willing to share with some built in routine like dancing or whatever.
It is going to take me a while to learn how to write a program so was hoping I could start to enjoy Hexy with something other people have written, as being tethered to PoCoMo gets old fast :slight_smile:
Thanks,

Edit TooManySecrets:

Moved to questions


#2

I search a sketch whit the code to move Hexy forward, left etc…


#3

I cant find any examples of these “skeches” when running a search on here :confused:


#4

There is currently only one example sketch that comes with hexy:

#include "Servotor32.h" // call the servotor32 Library
Servotor32 hexy; // create a servotor32 object

void setup() {
  hexy.begin();
}

void loop() {
  // blink the status led
  digitalWrite(STATUS_LED, HIGH);
  hexy.delay_ms(500); // wait 500mS
  digitalWrite(STATUS_LED, LOW);
  hexy.delay_ms(500); // wait 500mS
  
  // kill all servos
  for(int i=0; i<32; i++){
    hexy.changeServo(i,-1);
  }
  
  // center servos 0,1,2,3
  hexy.changeServo(0,1500);
  hexy.changeServo(1,1500);
  hexy.changeServo(2,1500);
  hexy.changeServo(3,1500);
  
  hexy.delay_ms(100); // wait 100mS
 
  while(true){
    // get a ping from the ultrasonic sensor in CM
    //Serial.print("CM: ");
    //Serial.println(hexy.ping());
    //hexy.delay_ms(200); // wait 200mS
    
    hexy.process(&Serial); //process input from the USB
    hexy.process(&Serial1); //process input from the board serial (i.e. bluetooth)
  }
  
}

You can see where it has it move on of the servos:

hexy.changeServo(3,1500);

1500 is center, 500 is full left rotate 90 degrees, and 2500 is full right rotate 90 degrees.

Although it runs an Arduino controller and can be programmed as such, its primarily intended to be used with PoMoCo. We’re are working on an Arduino move code generator, but that won’t be until the next PoMoCo release. We have also hired a tutorial writer, who is working on Sparki right now, and will be working on Hexy after they’re done in a month or so. If you need a basic Arduino code tutorial, the Sparki one covers the basics:
arcbotics.com/lessons/basic-code/