mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
33 lines
695 B
Plaintext
33 lines
695 B
Plaintext
/*
|
|
Sketch that manipulates Arduino outputs to create the "Cylon Eyes" effect from
|
|
Battlestar Galactica. It uses the ChaseLEDs utility class.
|
|
|
|
This example is placed into the public domain.
|
|
*/
|
|
|
|
#include <ChaseLEDs.h>
|
|
|
|
class CylonChase : public ChaseLEDs
|
|
{
|
|
public:
|
|
CylonChase(const byte *pins, int num, unsigned long advanceTime)
|
|
: ChaseLEDs(pins, num, advanceTime) {}
|
|
|
|
protected:
|
|
void advance(byte prevPin, byte nextPin) {
|
|
digitalWrite(previousPin(2), LOW);
|
|
digitalWrite(prevPin, HIGH);
|
|
digitalWrite(nextPin, HIGH);
|
|
}
|
|
};
|
|
|
|
byte pins[] = {3, 5, 6, 9, 10, 11, 10, 9, 6, 5};
|
|
CylonChase cylonEyes(pins, sizeof(pins), 100);
|
|
|
|
void setup() {}
|
|
|
|
void loop() {
|
|
cylonEyes.loop();
|
|
}
|
|
|