Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
Plasma Caster [UPDATE]
Thought I would share what I've been working on. This is still in early testing stages, but its always fun to play around with pan/tilt systems. There is a better explanation and video on my site.
Now using Ping))) for the pan servo. The tilt will be via accelerometer.
CODE:
/*
pan_tilt_sketch.pde
This is quick and dirty code to
move a servo in the direction my head moves.
=-=-hacked version of Ping))) example-=-=
Modded by Tech B.
*/
#include <Servo.h>
const int pingPin = 7;
Servo pan;
//tilt not used at the moment
Servo tilt;
//initial position
int panPos = 90;
void setup() {
Serial.begin(9600);
pan.attach(3);
tilt.attach(12);
tilt.write(90);
pan.write(90);
}
//Vars for ping readings
int val;
int valfil;
long duration;
void loop()
{
// The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin, LOW);
// The same pin is used to read the signal from the PING))): a HIGH
// pulse whose duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(pingPin, INPUT);
duration = pulseIn(pingPin, HIGH);
// convert the time into a distance
// notice the mapped values are kind flipped _
// this is because I have the servo flipped around.
val = map(duration, 29*2*20, 29*2*1, 0, 180);
// try to smooth the signal so the servo _
// isn't as jittery
valfil = val * (1.0-0.05)+ val * 0.05;
// write new posistion, and delay so it can have _
// time to move there. Play around with delay() to _
// smooth out movement.
pan.write(valfil);
delay(100);
}
I've been working on using an LCD Display shield, but I should have my HTC tomorrow, and using the HTC as a control unit instead of wearing a backpack with a running laptop in it. It will all depend if I can use a COM port on the HTC platform. I will also need to get another BT board or an XBee shield since I fried the only BT board I had.