I'd never heard of an Arduino until a few weeks ago, so I'm what you'd call a "new-bee." My next-door neighbor who dabbles in robotics turned me on to it. I have a very rudimentary knowledge of building circuits and some experience writing (mainly adapting) simple expressions in After Effects (computer animation is my profession.)
I'm in the process of building a new version of a Ghostbusters PKE meter I originally made in 1989:
http://www.gbfans.com/fans/props/PKE-meters/2961/
For my new, more-accurate version I plan to use a Teensy 3.1 to drive two servos for the arms and the LED chaser, activated by two touch switches. One switch sends the arms halfway up, the other sends them all the way up. The lights activate whenever either touch switch is engaged, their speed controlled by a pot in the neck of the prop.
I've had a fair amount of luck adapting various existing sketches to create something that mostly works. For now I've got momentary contact switches instead of touch switches (which I still need to figure out).
My prototype mostly works except for the LED chaser, which I adapted from this design:
http://rweather.github.io/arduinolibs/blink_startrek.html
The problem I'm having is that whatever LED was lit when the switch opens stays on. ALL of the LEDs should be off when the arms go down. Here's a 9 MB MPG which shows the setup:
http://marshall-arts.net/PKE/PKE%20Demo.mp4
I'm not sure what I have to do to make all of the lights extinguish. I also need to figure out how to make a single LED blink at the frequency of the wing LEDs (blinking as each LED in the wings sequences).
Here's my code. Sorry if it's horribly inefficient or something:
#include <Servo.h>
#include <ChaseLEDs.h>
#define NACELLE_RATE 22 // Analog input for reading the nacelle chase rate
#define NACELLE_CHASE_LEN 7 // Length of nacelle chase, 1..6
#define NACELLE_MIN_PERIOD 25 // Minimum time to advance the nacelle chase (milliseconds)
#define NACELLE_MAX_PERIOD 250 // Maximum time to advance the nacelle chase (milliseconds)
#define NACELLE_DIM_VALUE 0 // Value for dimming previous LED in chase, 0..255
// Output pins to use for the nacelle chase
byte nacelleChasePins[7] = {14, 15, 16, 17, 18, 19, 20};
class NacelleChaseLEDs : public ChaseLEDs
{
public:
NacelleChaseLEDs(const byte *pins, int num)
: ChaseLEDs(pins, num, 0) {}
protected:
void advance(byte prevPin, byte nextPin) {
digitalWrite(previousPin(2), LOW);
analogWrite(prevPin, NACELLE_DIM_VALUE);
digitalWrite(nextPin, HIGH);
setAdvanceTime(map(analogRead(NACELLE_RATE), 0, 1023, NACELLE_MIN_PERIOD, NACELLE_MAX_PERIOD));
}
};
NacelleChaseLEDs nacelleChase(nacelleChasePins, NACELLE_CHASE_LEN);
Servo myservoL; // create servo object to control a servo
// a maximum of eight servo objects can be created
Servo myservoR;
void setup()
{
myservoL.attach(9);
myservoR.attach(10);
pinMode(13, OUTPUT); // LED
pinMode(12, INPUT_PULLUP); // Pushbutton
pinMode(11, INPUT_PULLUP); // Pushbutton
}
void loop()
{
if (digitalRead(12)) // 12 pin is high due to pullup resistor - Returns 1, so this block happens. If it returns 0 (button pressed, pin goes low), else happens
{
digitalWrite(13, LOW); // LED off
if (digitalRead(11)) // 11 pin is high due to pullup resistor - Returns 1, so this block happens. If it returns 0 (button pressed, pin goes low), else happens
{
myservoL.write(20);
myservoR.write(140);
}
else
{
// Pin is Low - returns 0 - 12 pin is low due to pushbutton pressed
digitalWrite(13, HIGH); // LED on
myservoL.write(80);
myservoR.write(80);
nacelleChase.loop();
}
}
else
{
// Pin is Low - returns 0 - 12 pin is low due to pushbutton pressed
digitalWrite(13, HIGH); // LED on
myservoL.write(140);
myservoR.write(20);
nacelleChase.loop();
}
}
Any suggestions as to a simple approach to this would be appreciated.
Thanks.
Shawn Marshall
Portland, OR