mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
Document StarTrek example
This commit is contained in:
parent
4a4ff39952
commit
6769df8776
@ -1,111 +0,0 @@
|
||||
/*
|
||||
Sketch that manipulates Arduino outputs to create Star Trek Enterprise style
|
||||
running lights and LED chasers. There are 4 types of lights on the Enterprise:
|
||||
|
||||
* Static lights in windows, engines, and the deflector dish.
|
||||
* Navigation lights on the left and right of the saucer with a 1 second period.
|
||||
* Strobe light that comes on briefly every second.
|
||||
* Nacelle lights that perform a LED chase in the front of the nacelle.
|
||||
There is provision for a chase of between 1 and 6 LED's. A typical configuration
|
||||
is 5 LED's in sequence (clockwise in one nacelle, counter-clockwise in the other).
|
||||
Another configuration uses a 3 LED sequence, driving 6 LED's organised in
|
||||
opposite pairs.
|
||||
|
||||
The static lights are not handled by this sketch. They are assumed to be
|
||||
connected directly to the Vcc and GND supply lines.
|
||||
|
||||
The nacelle lights use the Arduino's PWM outputs, so that the previous LED in the
|
||||
chase can be dimmed slightly rather than completely turned off, to give a trailing
|
||||
flame effect. NACELLE_DIM_VALUE can be used to set the amount of dimming
|
||||
(0 = completely off, 255 = completely on).
|
||||
|
||||
All outputs should be connected to the base of an NPN transistor (e.g. BC548)
|
||||
via a 10K resistor to drive the actual LED's, as there will typically be multiple
|
||||
LED's on each output. For example, there are typically 4 navigation lights:
|
||||
red/green on the top of the saucer and red/green on the bottom of the saucer.
|
||||
Nacelle lights with a 3 LED chase will have 4 LED's on each output - two in
|
||||
each nacelle.
|
||||
*/
|
||||
|
||||
#include <BlinkLED.h>
|
||||
#include <ChaseLEDs.h>
|
||||
|
||||
#define NAV_LIGHTS A2 // Red/green navigational lights
|
||||
#define STROBE_LIGHT A3 // Strobe light
|
||||
#define NACELLE_1 3 // Nacelle twirl chase LED 1
|
||||
#define NACELLE_2 5 // Nacelle twirl chase LED 2
|
||||
#define NACELLE_3 6 // Nacelle twirl chase LED 3
|
||||
#define NACELLE_4 9 // Nacelle twirl chase LED 4
|
||||
#define NACELLE_5 10 // Nacelle twirl chase LED 5
|
||||
#define NACELLE_6 11 // Nacelle twirl chase LED 6
|
||||
#define NACELLE_RATE A0 // Analog input that defines the rate of the nacelle chase
|
||||
|
||||
#define NAV_LIGHTS_ON 1000
|
||||
#define NAV_LIGHTS_OFF 1000
|
||||
#define STROBE_LIGHT_ON 70
|
||||
#define STROBE_LIGHT_OFF 830
|
||||
#define NACELLE_CHASE_LEN 6 // Length of nacelle chase, 1..6
|
||||
#define NACELLE_MIN_PERIOD 25
|
||||
#define NACELLE_MAX_PERIOD 250
|
||||
#define NACELLE_DIM_VALUE 32 // Value for dimming previous LED in chase, 0..255
|
||||
|
||||
byte nacelleChasePins[6] = {
|
||||
NACELLE_1,
|
||||
NACELLE_2,
|
||||
NACELLE_3,
|
||||
NACELLE_4,
|
||||
NACELLE_5,
|
||||
NACELLE_6
|
||||
};
|
||||
|
||||
class NacelleChaseLEDs : public ChaseLEDs
|
||||
{
|
||||
public:
|
||||
NacelleChaseLEDs(const byte *pins, int num);
|
||||
|
||||
protected:
|
||||
void advance(byte prevPin, byte nextPin);
|
||||
|
||||
private:
|
||||
void readChaseTime();
|
||||
};
|
||||
|
||||
BlinkLED navLights(NAV_LIGHTS, NAV_LIGHTS_ON, NAV_LIGHTS_OFF);
|
||||
BlinkLED strobeLight(STROBE_LIGHT, STROBE_LIGHT_ON, STROBE_LIGHT_OFF);
|
||||
NacelleChaseLEDs nacelleChase(nacelleChasePins, NACELLE_CHASE_LEN);
|
||||
|
||||
void setup() {
|
||||
// Turn off the status LED on the Arduino board (we don't need it).
|
||||
pinMode(13, OUTPUT);
|
||||
digitalWrite(13, LOW);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
navLights.loop();
|
||||
strobeLight.loop();
|
||||
nacelleChase.loop();
|
||||
}
|
||||
|
||||
NacelleChaseLEDs::NacelleChaseLEDs(const byte *pins, int num)
|
||||
: ChaseLEDs(pins, num, 0)
|
||||
{
|
||||
// Initialize the analog input for the nacelle chaser rate.
|
||||
pinMode(NACELLE_RATE, INPUT);
|
||||
digitalWrite(NACELLE_RATE, LOW);
|
||||
readChaseTime();
|
||||
}
|
||||
|
||||
void NacelleChaseLEDs::advance(byte prevPin, byte nextPin)
|
||||
{
|
||||
digitalWrite(previousPin(2), LOW);
|
||||
analogWrite(prevPin, NACELLE_DIM_VALUE);
|
||||
digitalWrite(nextPin, HIGH);
|
||||
readChaseTime();
|
||||
}
|
||||
|
||||
void NacelleChaseLEDs::readChaseTime()
|
||||
{
|
||||
int val = analogRead(NACELLE_RATE);
|
||||
setAdvanceTime(map(val, 0, 1023, NACELLE_MIN_PERIOD, NACELLE_MAX_PERIOD));
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ EXAMPLE_RECURSIVE = NO
|
||||
# directories that contain image that are included in the documentation (see
|
||||
# the \image command).
|
||||
|
||||
IMAGE_PATH = ../libraries/BlinkLED/examples/Cylon ../libraries/BlinkLED/examples/Cylon4
|
||||
IMAGE_PATH = ../libraries/BlinkLED/examples/Cylon ../libraries/BlinkLED/examples/Cylon4 ../libraries/BlinkLED/examples/StarTrek
|
||||
|
||||
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
||||
|
165
doc/blink-startrek.dox
Normal file
165
doc/blink-startrek.dox
Normal file
@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
\file blink-startrek.dox
|
||||
\page blink_startrek Star Trek Example
|
||||
|
||||
This example shows how to use the BlinkLED and ChaseLEDs classes to
|
||||
simulate the running lights on the starship Enterprise from Star Trek.
|
||||
This can be used as the basis for lighting a model kit. It is
|
||||
recommended that you read the \ref blink_blink "Blink" and
|
||||
\ref blink_cylon "Cylon" tutorials first.
|
||||
|
||||
There are four categories of lights on the Enterprise:
|
||||
|
||||
\li Static lights in windows, engines, and the deflector dish.
|
||||
We don't handle those in this example as we assume that they are
|
||||
connected directly to the power supply with no computer control.
|
||||
\li Red and green navigation lights on the left and right of the saucer,
|
||||
and on the left and right warp nacelles, typically with a 1 second period.
|
||||
The red light is on the left as viewed from the back of the model.
|
||||
\li White strobe light behind the bridge and on the warp nacelles
|
||||
that comes on briefly every second.
|
||||
\li Nacelle lights that perform a circular LED chase in the front of the
|
||||
nacelles to create the warp engine twirl effect.
|
||||
|
||||
Different models of the Enterprise have the lights in different places,
|
||||
and the period of flashing can vary from TV show to show, and sometimes
|
||||
from episode to episode. There isn't a definitive set of blink timings
|
||||
or number of LED's in the nacelle chase. The sketch has a number of
|
||||
configurable parameters that gives the user the freedom to choose which
|
||||
show and/or episode they wish to treat as "canonical" for their model.
|
||||
|
||||
We start by building a test circuit with a small number of LED's for
|
||||
each of the three categories (navigation, strobe, and nacelles):
|
||||
|
||||
\image html StarTrek.png
|
||||
|
||||
This won't be the final circuit for the model, but building it on a
|
||||
breadboard will help with the initial prototyping stages and choosing
|
||||
the appropriate blink timings:
|
||||
|
||||
\image html StarTrekBreadboard.png
|
||||
|
||||
Alternatively, the test circuit can be built on a prototyping shield
|
||||
with the chase LED's in a circular arrangement to simulate how they will
|
||||
look when placed in the front of the model's warp nacelles:
|
||||
|
||||
\image html StarTrekShield.png
|
||||
|
||||
Now that we have a circuit, let's configure the red navigation LED on AOUT2
|
||||
using the BlinkLED class, to blink with a period of 1000 milliseconds on,
|
||||
1000 milliseconds off:
|
||||
|
||||
\dontinclude BlinkLED/examples/StarTrek/StarTrek.pde
|
||||
\skip <BlinkLED.h>
|
||||
\until <BlinkLED.h>
|
||||
\skip NAV_LIGHTS
|
||||
\until NAV_LIGHTS
|
||||
\skip NAV_LIGHTS_ON
|
||||
\until NAV_LIGHTS_OFF
|
||||
\skip navLights
|
||||
\until navLights
|
||||
|
||||
We repeat the process for the strobe LED on AOUT3, with a period of
|
||||
70 milliseconds on, and 830 milliseconds off:
|
||||
|
||||
\dontinclude BlinkLED/examples/StarTrek/StarTrek.pde
|
||||
\skip STROBE_LIGHT
|
||||
\until STROBE_LIGHT
|
||||
\skip STROBE_LIGHT_ON
|
||||
\until STROBE_LIGHT_OFF
|
||||
\skip strobeLight
|
||||
\until strobeLight
|
||||
|
||||
We also need to arrange for BlinkLED::loop() to be called from the
|
||||
application's main <tt>loop()</tt> function:
|
||||
|
||||
\code
|
||||
void loop() {
|
||||
navLights.loop();
|
||||
strobeLight.loop();
|
||||
}
|
||||
\endcode
|
||||
|
||||
If you run the sketch at this point, you should see the navigation and
|
||||
strobe LED's blink with the selected rates.
|
||||
|
||||
Next is the twirl effect in the warp nacelles, using the ChaseLEDs
|
||||
class. We are actually going to inherit from ChaseLEDs to create a
|
||||
custom LED chaser that reads the chase rate from AIN0 and uses PWM
|
||||
outputs to create a trailing flame effect. See the
|
||||
\ref blink_cylon "Cylon" example for more information on creating
|
||||
custom effects with ChaseLEDs.
|
||||
|
||||
\dontinclude BlinkLED/examples/StarTrek/StarTrek.pde
|
||||
\skip NACELLE_CHASE_LEN
|
||||
\until NacelleChaseLEDs nacelleChase
|
||||
|
||||
We also need to add a call to ChaseLEDs::loop() to the application's
|
||||
main loop:
|
||||
|
||||
\dontinclude BlinkLED/examples/StarTrek/StarTrek.pde
|
||||
\skip loop()
|
||||
\until }
|
||||
|
||||
Running the sketch now should cause the six LED's in the nacelle
|
||||
sequence to chase, in addition to the navigation and strobe LED's.
|
||||
The 10K potentiometer can be used to select the desired chase rate.
|
||||
This completes the test circuit, and will allow you to fiddle with
|
||||
the blink timings and chase rate until you are happy with the result.
|
||||
|
||||
We've made provision in this sketch for six outputs in the chase,
|
||||
but some models may only use three or five. The <tt>NACELLE_CHASE_LEN</tt>
|
||||
parameter controls the length of the chase.
|
||||
|
||||
With three outputs, the LED's can be arranged in opposite pairs,
|
||||
lighting two LED's at a time. The following circuit demonstrates
|
||||
how three outputs can be used to drive six LED's:
|
||||
|
||||
\image html ThreeChase.png
|
||||
|
||||
You will need two of these circuits, for the left and right warp nacelles.
|
||||
The transistor drivers reduce the current load on the Arduino CPU and
|
||||
provide the option to drive the LED's from 12V instead of 5V.
|
||||
|
||||
It is recommended that you use transistor drivers for the navigation and
|
||||
strobe lights as well as there will be multiple LED's on each output in a
|
||||
real model. For example, there will be at least three each of the red
|
||||
and green navigation lights: the top of the saucer section, the bottom of
|
||||
the saucer section, and the top of the warp nacelle. Using a 12V supply
|
||||
will make it easier to string lots of LED's together in series.
|
||||
|
||||
Other nacelle effects are possible by modifying the <tt>advance()</tt> method
|
||||
in the sketch. For example, the "opposite pairs" effect with 3 outputs
|
||||
can also be done with 6 outputs and the following modification to the sketch:
|
||||
|
||||
\dontinclude BlinkLED/examples/StarTrek2/StarTrek2.pde
|
||||
\skip advance(byte
|
||||
\until }
|
||||
|
||||
The full source code for the example, including the "opposite pairs"
|
||||
effect, follows:
|
||||
|
||||
\include BlinkLED/examples/StarTrek2/StarTrek2.pde
|
||||
*/
|
@ -44,5 +44,7 @@ over several output pins.
|
||||
\li \ref blink_blink "Blink" example of using BlinkLED.
|
||||
\li \ref blink_cylon "Cylon" example of using ChaseLEDs to simulate
|
||||
the Cylon eye effect from Battlestar Galactica.
|
||||
\li \ref blink_startrek "StarTrek" example for lighting a starship
|
||||
Enterprise model kit.
|
||||
|
||||
*/
|
||||
|
338
libraries/BlinkLED/examples/StarTrek/StarTrek.fig
Normal file
338
libraries/BlinkLED/examples/StarTrek/StarTrek.fig
Normal file
@ -0,0 +1,338 @@
|
||||
#FIG 3.2 Produced by xfig version 3.2.5b
|
||||
Landscape
|
||||
Center
|
||||
Metric
|
||||
A4
|
||||
100.00
|
||||
Single
|
||||
-2
|
||||
1200 2
|
||||
6 6075 1530 8100 2475
|
||||
6 6435 1755 6885 1845
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
6530 1800 6435 1800
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
6795 1800 6768 1760 6714 1840 6660 1760 6606 1840 6552 1760
|
||||
6525 1800
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
6885 1800 6790 1800
|
||||
-6
|
||||
6 7245 1665 7605 1890
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
7470 1800 7380 1755 7380 1845 7470 1800
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7470 1800 7605 1800
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7470 1855 7470 1745
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7425 1665 7470 1710
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
7470 1665 7425 1665 7425 1710
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
7380 1665 7335 1665 7335 1710
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7335 1665 7380 1710
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7245 1800 7380 1800
|
||||
-6
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
6435 1800 6075 1800
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
6885 1800 7290 1800
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
|
||||
7560 1800 8100 1800 8100 2475
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 450 6435 1665 220R\001
|
||||
-6
|
||||
6 6075 2205 8100 3150
|
||||
6 6435 2430 6885 2520
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
6530 2475 6435 2475
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
6795 2475 6768 2435 6714 2515 6660 2435 6606 2515 6552 2435
|
||||
6525 2475
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
6885 2475 6790 2475
|
||||
-6
|
||||
6 7245 2340 7605 2565
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
7470 2475 7380 2430 7380 2520 7470 2475
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7470 2475 7605 2475
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7470 2530 7470 2420
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7425 2340 7470 2385
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
7470 2340 7425 2340 7425 2385
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
7380 2340 7335 2340 7335 2385
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7335 2340 7380 2385
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7245 2475 7380 2475
|
||||
-6
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
6435 2475 6075 2475
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
6885 2475 7290 2475
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
|
||||
7560 2475 8100 2475 8100 3150
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 450 6435 2340 220R\001
|
||||
-6
|
||||
6 6075 2880 8100 3825
|
||||
6 6435 3105 6885 3195
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
6530 3150 6435 3150
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
6795 3150 6768 3110 6714 3190 6660 3110 6606 3190 6552 3110
|
||||
6525 3150
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
6885 3150 6790 3150
|
||||
-6
|
||||
6 7245 3015 7605 3240
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
7470 3150 7380 3105 7380 3195 7470 3150
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7470 3150 7605 3150
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7470 3205 7470 3095
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7425 3015 7470 3060
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
7470 3015 7425 3015 7425 3060
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
7380 3015 7335 3015 7335 3060
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7335 3015 7380 3060
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7245 3150 7380 3150
|
||||
-6
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
6435 3150 6075 3150
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
6885 3150 7290 3150
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
|
||||
7560 3150 8100 3150 8100 3825
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 450 6435 3015 220R\001
|
||||
-6
|
||||
6 6075 3555 8100 4500
|
||||
6 6435 3780 6885 3870
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
6530 3825 6435 3825
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
6795 3825 6768 3785 6714 3865 6660 3785 6606 3865 6552 3785
|
||||
6525 3825
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
6885 3825 6790 3825
|
||||
-6
|
||||
6 7245 3690 7605 3915
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
7470 3825 7380 3780 7380 3870 7470 3825
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7470 3825 7605 3825
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7470 3880 7470 3770
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7425 3690 7470 3735
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
7470 3690 7425 3690 7425 3735
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
7380 3690 7335 3690 7335 3735
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7335 3690 7380 3735
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7245 3825 7380 3825
|
||||
-6
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
6435 3825 6075 3825
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
6885 3825 7290 3825
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
|
||||
7560 3825 8100 3825 8100 4500
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 450 6435 3690 220R\001
|
||||
-6
|
||||
6 6075 4230 8100 5175
|
||||
6 6435 4455 6885 4545
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
6530 4500 6435 4500
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
6795 4500 6768 4460 6714 4540 6660 4460 6606 4540 6552 4460
|
||||
6525 4500
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
6885 4500 6790 4500
|
||||
-6
|
||||
6 7245 4365 7605 4590
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
7470 4500 7380 4455 7380 4545 7470 4500
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7470 4500 7605 4500
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7470 4555 7470 4445
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7425 4365 7470 4410
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
7470 4365 7425 4365 7425 4410
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
7380 4365 7335 4365 7335 4410
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7335 4365 7380 4410
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7245 4500 7380 4500
|
||||
-6
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
6435 4500 6075 4500
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
6885 4500 7290 4500
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
|
||||
7560 4500 8100 4500 8100 5175
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 450 6435 4365 220R\001
|
||||
-6
|
||||
6 6075 4905 8100 5850
|
||||
6 6435 5130 6885 5220
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
6530 5175 6435 5175
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
6795 5175 6768 5135 6714 5215 6660 5135 6606 5215 6552 5135
|
||||
6525 5175
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
6885 5175 6790 5175
|
||||
-6
|
||||
6 7245 5040 7605 5265
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
7470 5175 7380 5130 7380 5220 7470 5175
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7470 5175 7605 5175
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7470 5230 7470 5120
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7425 5040 7470 5085
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
7470 5040 7425 5040 7425 5085
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
7380 5040 7335 5040 7335 5085
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7335 5040 7380 5085
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
7245 5175 7380 5175
|
||||
-6
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
6435 5175 6075 5175
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
6885 5175 7290 5175
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
|
||||
7560 5175 8100 5175 8100 5850
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 450 6435 5040 220R\001
|
||||
-6
|
||||
6 1530 2700 1755 3150
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
1620 2925 1690 2890 1690 2960 1620 2925
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
1575 3055 1575 3150
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
1575 2790 1615 2817 1535 2871 1615 2925 1535 2979 1615 3033
|
||||
1575 3060
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
1575 2700 1575 2795
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
1755 2925 1665 2925
|
||||
-6
|
||||
6 1575 3465 3600 3915
|
||||
6 2565 3780 3015 3870
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
2660 3825 2565 3825
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
2925 3825 2898 3785 2844 3865 2790 3785 2736 3865 2682 3785
|
||||
2655 3825
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
3015 3825 2920 3825
|
||||
-6
|
||||
6 1890 3690 2250 3915
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
2025 3825 2115 3780 2115 3870 2025 3825
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
2025 3825 1890 3825
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
2025 3880 2025 3770
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
2070 3690 2025 3735
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
2025 3690 2070 3690 2070 3735
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
2115 3690 2160 3690 2160 3735
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
2160 3690 2115 3735
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
2250 3825 2115 3825
|
||||
-6
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
2970 3825 3600 3825
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
2160 3825 2610 3825
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
1935 3825 1575 3825
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 450 2610 3600 220R\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 390 1935 3600 RED\001
|
||||
-6
|
||||
6 2565 4680 3015 4770
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
2660 4725 2565 4725
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
2925 4725 2898 4685 2844 4765 2790 4685 2736 4765 2682 4685
|
||||
2655 4725
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
3015 4725 2920 4725
|
||||
-6
|
||||
6 1890 4590 2250 4815
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
2025 4725 2115 4680 2115 4770 2025 4725
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
2025 4725 1890 4725
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
2025 4780 2025 4670
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
2070 4590 2025 4635
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
2025 4590 2070 4590 2070 4635
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
2115 4590 2160 4590 2160 4635
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
2160 4590 2115 4635
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
2250 4725 2115 4725
|
||||
-6
|
||||
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
|
||||
3600 1350 6075 1350 6075 6300 3600 6300 3600 1350
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
8100 5850 6075 5850
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
|
||||
1575 2700 1575 1800 3600 1800
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
|
||||
1575 3150 1575 5850 3600 5850
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
1755 2925 3600 2925
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
2970 4725 3600 4725
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
2160 4725 2610 4725
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
1935 4725 1575 4725
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 630 5175 2565 DOUT5\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 630 5175 1845 DOUT3\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 630 5175 3195 DOUT6\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 630 5175 3870 DOUT9\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 735 5175 4545 DOUT10\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 735 5175 5220 DOUT11\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 405 5400 5895 GND\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 240 3735 1845 5V\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 405 3690 5895 GND\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 1065 4230 1215 Arduino Uno\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 435 3735 3015 AIN0\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 345 1080 3015 10K\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 450 2610 4500 100R\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 615 1800 4500 WHITE\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 630 3690 4770 AOUT3\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 630 3690 3870 AOUT2\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 1110 8370 3510 6 x RED LED\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 690 8505 4050 Nacelles\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 180 915 495 3870 Navigation\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 525 675 4770 Strobe\001
|
59
libraries/BlinkLED/examples/StarTrek/StarTrek.pde
Normal file
59
libraries/BlinkLED/examples/StarTrek/StarTrek.pde
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
Sketch that manipulates Arduino outputs to create Star Trek Enterprise style
|
||||
running lights and LED chasers.
|
||||
|
||||
This example is placed into the public domain.
|
||||
*/
|
||||
|
||||
#include <BlinkLED.h>
|
||||
#include <ChaseLEDs.h>
|
||||
|
||||
#define NACELLE_RATE A0 // Analog input for reading the nacelle chase rate
|
||||
#define NAV_LIGHTS A2 // Output pin for controlling the navigation lights
|
||||
#define STROBE_LIGHT A3 // Output pin for controlling the strobe
|
||||
|
||||
// Configurable parameters.
|
||||
#define NAV_LIGHTS_ON 1000 // Time the navigation lights are on (milliseconds)
|
||||
#define NAV_LIGHTS_OFF 1000 // Time the navigation lights are off (milliseconds)
|
||||
#define STROBE_LIGHT_ON 70 // Time the strobe light is on (milliseconds)
|
||||
#define STROBE_LIGHT_OFF 830 // Time the strobe light is off (milliseconds)
|
||||
#define NACELLE_CHASE_LEN 6 // 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 32 // Value for dimming previous LED in chase, 0..255
|
||||
|
||||
// Output pins to use for the nacelle chase
|
||||
byte nacelleChasePins[6] = {3, 5, 6, 9, 10, 11};
|
||||
|
||||
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);
|
||||
|
||||
BlinkLED navLights(NAV_LIGHTS, NAV_LIGHTS_ON, NAV_LIGHTS_OFF);
|
||||
BlinkLED strobeLight(STROBE_LIGHT, STROBE_LIGHT_ON, STROBE_LIGHT_OFF);
|
||||
|
||||
void setup() {
|
||||
// Turn off the status LED on the Arduino board (we don't need it).
|
||||
pinMode(13, OUTPUT);
|
||||
digitalWrite(13, LOW);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
navLights.loop();
|
||||
strobeLight.loop();
|
||||
nacelleChase.loop();
|
||||
}
|
||||
|
BIN
libraries/BlinkLED/examples/StarTrek/StarTrek.png
Normal file
BIN
libraries/BlinkLED/examples/StarTrek/StarTrek.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
libraries/BlinkLED/examples/StarTrek/StarTrekBreadboard.png
Normal file
BIN
libraries/BlinkLED/examples/StarTrek/StarTrekBreadboard.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1019 KiB |
BIN
libraries/BlinkLED/examples/StarTrek/StarTrekShield.png
Normal file
BIN
libraries/BlinkLED/examples/StarTrek/StarTrekShield.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 474 KiB |
292
libraries/BlinkLED/examples/StarTrek/ThreeChase.fig
Normal file
292
libraries/BlinkLED/examples/StarTrek/ThreeChase.fig
Normal file
@ -0,0 +1,292 @@
|
||||
#FIG 3.2 Produced by xfig version 3.2.5b
|
||||
Landscape
|
||||
Center
|
||||
Metric
|
||||
A4
|
||||
100.00
|
||||
Single
|
||||
-2
|
||||
1200 2
|
||||
6 10260 2025 10485 2385
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
10350 2250 10395 2160 10305 2160 10350 2250
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10350 2250 10350 2385
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10295 2250 10405 2250
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10485 2205 10440 2250
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
10485 2250 10485 2205 10440 2205
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
10485 2160 10485 2115 10440 2115
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10485 2115 10440 2160
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10350 2025 10350 2160
|
||||
-6
|
||||
6 10260 3600 10485 3960
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
10350 3825 10395 3735 10305 3735 10350 3825
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10350 3825 10350 3960
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10295 3825 10405 3825
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10485 3780 10440 3825
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
10485 3825 10485 3780 10440 3780
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
10485 3735 10485 3690 10440 3690
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10485 3690 10440 3735
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10350 3600 10350 3735
|
||||
-6
|
||||
6 9585 2475 9810 2835
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
9675 2700 9720 2610 9630 2610 9675 2700
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9675 2700 9675 2835
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9620 2700 9730 2700
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9810 2655 9765 2700
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
9810 2700 9810 2655 9765 2655
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
9810 2610 9810 2565 9765 2565
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9810 2565 9765 2610
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9675 2475 9675 2610
|
||||
-6
|
||||
6 10935 2475 11160 2835
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
11025 2700 11070 2610 10980 2610 11025 2700
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
11025 2700 11025 2835
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10970 2700 11080 2700
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
11160 2655 11115 2700
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
11160 2700 11160 2655 11115 2655
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
11160 2610 11160 2565 11115 2565
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
11160 2565 11115 2610
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
11025 2475 11025 2610
|
||||
-6
|
||||
6 10935 3150 11160 3510
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
11025 3375 11070 3285 10980 3285 11025 3375
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
11025 3375 11025 3510
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10970 3375 11080 3375
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
11160 3330 11115 3375
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
11160 3375 11160 3330 11115 3330
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
11160 3285 11160 3240 11115 3240
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
11160 3240 11115 3285
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
11025 3150 11025 3285
|
||||
-6
|
||||
6 9585 3150 9810 3510
|
||||
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
|
||||
9675 3375 9720 3285 9630 3285 9675 3375
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9675 3375 9675 3510
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9620 3375 9730 3375
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9810 3330 9765 3375
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
9810 3375 9810 3330 9765 3330
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
|
||||
9810 3285 9810 3240 9765 3240
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9810 3240 9765 3285
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9675 3150 9675 3285
|
||||
-6
|
||||
6 10305 3915 10395 4365
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10350 4270 10350 4365
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
10350 4005 10310 4032 10390 4086 10310 4140 10390 4194 10310 4248
|
||||
10350 4275
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10350 3915 10350 4010
|
||||
-6
|
||||
6 9630 3915 9720 4365
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9675 4270 9675 4365
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
9675 4005 9635 4032 9715 4086 9635 4140 9715 4194 9635 4248
|
||||
9675 4275
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9675 3915 9675 4010
|
||||
-6
|
||||
6 10980 3915 11070 4365
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
11025 4270 11025 4365
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
11025 4005 10985 4032 11065 4086 10985 4140 11065 4194 10985 4248
|
||||
11025 4275
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
11025 3915 11025 4010
|
||||
-6
|
||||
6 9450 4365 9675 4635
|
||||
2 3 0 1 0 -1 0 0 20 0.000 0 0 0 0 0 4
|
||||
9627 4584 9597 4519 9562 4554 9627 4584
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9540 4500 9675 4635
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9540 4500 9675 4365
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9540 4410 9540 4590
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9540 4500 9450 4500
|
||||
-6
|
||||
6 10305 1710 10620 2025
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 1 0 2
|
||||
1 1 1.00 45.00 90.00
|
||||
10350 2025 10350 1710
|
||||
4 0 0 0 0 16 6 0.0000 4 75 225 10395 1845 VCC\001
|
||||
-6
|
||||
6 9585 4635 9765 4905
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9660 4905 9690 4905
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9625 4860 9725 4860
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9585 4815 9765 4815
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9675 4635 9675 4815
|
||||
-6
|
||||
6 10125 5175 10350 5445
|
||||
2 3 0 1 0 -1 0 0 20 0.000 0 0 0 0 0 4
|
||||
10302 5394 10272 5329 10237 5364 10302 5394
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10215 5310 10350 5445
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10215 5310 10350 5175
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10215 5220 10215 5400
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10215 5310 10125 5310
|
||||
-6
|
||||
6 10260 5445 10440 5715
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10335 5715 10365 5715
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10300 5670 10400 5670
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10260 5625 10440 5625
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10350 5445 10350 5625
|
||||
-6
|
||||
6 8550 5265 9000 5355
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
8645 5310 8550 5310
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
8910 5310 8883 5270 8829 5350 8775 5270 8721 5350 8667 5270
|
||||
8640 5310
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9000 5310 8905 5310
|
||||
-6
|
||||
6 8550 4455 9000 4545
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
8645 4500 8550 4500
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
8910 4500 8883 4460 8829 4540 8775 4460 8721 4540 8667 4460
|
||||
8640 4500
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9000 4500 8905 4500
|
||||
-6
|
||||
6 10800 5985 11025 6255
|
||||
2 3 0 1 0 -1 0 0 20 0.000 0 0 0 0 0 4
|
||||
10977 6204 10947 6139 10912 6174 10977 6204
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10890 6120 11025 6255
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10890 6120 11025 5985
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10890 6030 10890 6210
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10890 6120 10800 6120
|
||||
-6
|
||||
6 8550 6075 9000 6165
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
8645 6120 8550 6120
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
|
||||
8910 6120 8883 6080 8829 6160 8775 6080 8721 6160 8667 6080
|
||||
8640 6120
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
9000 6120 8905 6120
|
||||
-6
|
||||
6 10935 6255 11115 6525
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
11010 6525 11040 6525
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10975 6480 11075 6480
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
10935 6435 11115 6435
|
||||
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
|
||||
11025 6255 11025 6435
|
||||
-6
|
||||
1 4 1 1 0 7 50 -1 -1 4.000 1 0.0000 10350 2970 945 945 9405 2970 11295 2970
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
10350 2340 10350 3690
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
|
||||
9675 2835 10215 2835 10215 3150 10260 3150 10305 3150
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
10395 3150 11025 3150
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
|
||||
11025 2835 10665 2835 10665 3105
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
|
||||
10665 3195 10665 3375 10395 3375
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4
|
||||
10305 3375 9990 3375 9990 3150 9675 3150
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
9675 3915 9675 3465
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
11025 3465 11025 3960
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
10350 4365 10350 5220
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
11025 4320 11025 5985
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4
|
||||
9675 2520 9675 2025 11025 2025 11025 2565
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
9495 4500 8955 4500
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
10125 5310 9000 5310
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
8550 4500 7875 4500
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
8550 5310 7875 5310
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
|
||||
10845 6120 8955 6120 9000 6120
|
||||
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
|
||||
8595 6120 7875 6120
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 345 8595 4365 10K\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 345 8595 5130 10K\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 345 8595 5940 10K\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 630 7110 4590 DOUT3\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 630 7110 5355 DOUT5\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 630 7110 6165 DOUT6\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 135 9810 4230 R\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 135 10485 4230 R\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 135 11160 4230 R\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 2190 6930 3510 R = 120 ohms for Vcc = 5V\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 2220 6930 3780 R = 1K ohms for Vcc = 12V\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 585 9720 4590 BC548\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 585 10395 5400 BC548\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 135 585 11070 6210 BC548\001
|
BIN
libraries/BlinkLED/examples/StarTrek/ThreeChase.png
Normal file
BIN
libraries/BlinkLED/examples/StarTrek/ThreeChase.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
62
libraries/BlinkLED/examples/StarTrek2/StarTrek2.pde
Normal file
62
libraries/BlinkLED/examples/StarTrek2/StarTrek2.pde
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
Sketch that manipulates Arduino outputs to create Star Trek Enterprise style
|
||||
running lights and LED chasers.
|
||||
|
||||
This example is placed into the public domain.
|
||||
*/
|
||||
|
||||
#include <BlinkLED.h>
|
||||
#include <ChaseLEDs.h>
|
||||
|
||||
#define NACELLE_RATE A0 // Analog input for reading the nacelle chase rate
|
||||
#define NAV_LIGHTS A2 // Output pin for controlling the navigation lights
|
||||
#define STROBE_LIGHT A3 // Output pin for controlling the strobe
|
||||
|
||||
// Configurable parameters.
|
||||
#define NAV_LIGHTS_ON 1000 // Time the navigation lights are on (milliseconds)
|
||||
#define NAV_LIGHTS_OFF 1000 // Time the navigation lights are off (milliseconds)
|
||||
#define STROBE_LIGHT_ON 70 // Time the strobe light is on (milliseconds)
|
||||
#define STROBE_LIGHT_OFF 830 // Time the strobe light is off (milliseconds)
|
||||
#define NACELLE_CHASE_LEN 6 // 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 32 // Value for dimming previous LED in chase, 0..255
|
||||
|
||||
// Output pins to use for the nacelle chase
|
||||
byte nacelleChasePins[6] = {3, 5, 6, 9, 10, 11};
|
||||
|
||||
class NacelleChaseLEDs : public ChaseLEDs
|
||||
{
|
||||
public:
|
||||
NacelleChaseLEDs(const byte *pins, int num)
|
||||
: ChaseLEDs(pins, num, 0) {}
|
||||
|
||||
protected:
|
||||
void advance(byte prevPin, byte nextPin) {
|
||||
digitalWrite(previousPin(5), LOW);
|
||||
analogWrite(previousPin(4), NACELLE_DIM_VALUE);
|
||||
digitalWrite(previousPin(3), HIGH);
|
||||
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);
|
||||
|
||||
BlinkLED navLights(NAV_LIGHTS, NAV_LIGHTS_ON, NAV_LIGHTS_OFF);
|
||||
BlinkLED strobeLight(STROBE_LIGHT, STROBE_LIGHT_ON, STROBE_LIGHT_OFF);
|
||||
|
||||
void setup() {
|
||||
// Turn off the status LED on the Arduino board (we don't need it).
|
||||
pinMode(13, OUTPUT);
|
||||
digitalWrite(13, LOW);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
navLights.loop();
|
||||
strobeLight.loop();
|
||||
nacelleChase.loop();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user