1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00

Document the BlinkLED and ChaseLEDs examples

This commit is contained in:
Rhys Weatherley
2012-04-11 17:05:13 +10:00
parent 45c2d09347
commit 4a4ff39952
16 changed files with 1063 additions and 20 deletions

View File

@@ -0,0 +1,32 @@
/*
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();
}