From 12169019447f2d583a67010db8efb6f06820d76e Mon Sep 17 00:00:00 2001 From: Alexander Kauerz Date: Thu, 9 Feb 2012 23:03:40 +0100 Subject: lolshield --- LoLShield/Charliplexing.cpp | 185 ++++++++++++++++++++ LoLShield/Charliplexing.h | 20 +++ LoLShield/Charliplexing.o | Bin 0 -> 7304 bytes LoLShield/Examples/Basic_Test/Basic_Test.pde | 172 +++++++++++++++++++ .../Examples/Basic_Test/applet/Basic_Test.cpp | 190 +++++++++++++++++++++ .../Examples/Basic_Test/applet/Basic_Test.cpp.eep | 1 + .../Examples/Basic_Test/applet/Basic_Test.cpp.elf | Bin 0 -> 13186 bytes .../Examples/Basic_Test/applet/Basic_Test.cpp.hex | 175 +++++++++++++++++++ .../Examples/Basic_Test/applet/Basic_Test.cpp.o | Bin 0 -> 8096 bytes .../Basic_Test/applet/HardwareSerial.cpp.o | Bin 0 -> 16304 bytes .../applet/LoLShield/Charliplexing.cpp.o | Bin 0 -> 7080 bytes LoLShield/Examples/Basic_Test/applet/Print.cpp.o | Bin 0 -> 25292 bytes .../Examples/Basic_Test/applet/WInterrupts.c.o | Bin 0 -> 5724 bytes LoLShield/Examples/Basic_Test/applet/WMath.cpp.o | Bin 0 -> 7060 bytes LoLShield/Examples/Basic_Test/applet/core.a | Bin 0 -> 94470 bytes .../Examples/Basic_Test/applet/pins_arduino.c.o | Bin 0 -> 3128 bytes LoLShield/Examples/Basic_Test/applet/wiring.c.o | Bin 0 -> 8844 bytes .../Examples/Basic_Test/applet/wiring_analog.c.o | Bin 0 -> 6660 bytes .../Examples/Basic_Test/applet/wiring_digital.c.o | Bin 0 -> 8372 bytes .../Examples/Basic_Test/applet/wiring_pulse.c.o | Bin 0 -> 6548 bytes .../Examples/Basic_Test/applet/wiring_shift.c.o | Bin 0 -> 4180 bytes LoLShield/Examples/Life/Life.pde | 120 +++++++++++++ .../charli_heart/applet/Charli/Charliplexing.cpp.o | Bin 0 -> 7432 bytes .../charli_heart/applet/HardwareSerial.cpp.o | Bin 0 -> 16304 bytes LoLShield/Examples/charli_heart/applet/Print.cpp.o | Bin 0 -> 25292 bytes .../Examples/charli_heart/applet/WInterrupts.c.o | Bin 0 -> 5724 bytes LoLShield/Examples/charli_heart/applet/WMath.cpp.o | Bin 0 -> 7060 bytes .../Examples/charli_heart/applet/charli_heart.cpp | 99 +++++++++++ .../charli_heart/applet/charli_heart.cpp.eep | 1 + .../charli_heart/applet/charli_heart.cpp.elf | Bin 0 -> 15510 bytes .../charli_heart/applet/charli_heart.cpp.hex | 148 ++++++++++++++++ .../charli_heart/applet/charli_heart.cpp.o | Bin 0 -> 6720 bytes LoLShield/Examples/charli_heart/applet/core.a | Bin 0 -> 94470 bytes .../Examples/charli_heart/applet/pins_arduino.c.o | Bin 0 -> 3128 bytes LoLShield/Examples/charli_heart/applet/wiring.c.o | Bin 0 -> 8844 bytes .../Examples/charli_heart/applet/wiring_analog.c.o | Bin 0 -> 6660 bytes .../charli_heart/applet/wiring_digital.c.o | Bin 0 -> 8372 bytes .../Examples/charli_heart/applet/wiring_pulse.c.o | Bin 0 -> 6548 bytes .../Examples/charli_heart/applet/wiring_shift.c.o | Bin 0 -> 4180 bytes LoLShield/Examples/charli_heart/charli_heart.pde | 82 +++++++++ 40 files changed, 1193 insertions(+) create mode 100644 LoLShield/Charliplexing.cpp create mode 100644 LoLShield/Charliplexing.h create mode 100644 LoLShield/Charliplexing.o create mode 100644 LoLShield/Examples/Basic_Test/Basic_Test.pde create mode 100644 LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp create mode 100644 LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.eep create mode 100644 LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.elf create mode 100644 LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.hex create mode 100644 LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.o create mode 100644 LoLShield/Examples/Basic_Test/applet/HardwareSerial.cpp.o create mode 100644 LoLShield/Examples/Basic_Test/applet/LoLShield/Charliplexing.cpp.o create mode 100644 LoLShield/Examples/Basic_Test/applet/Print.cpp.o create mode 100644 LoLShield/Examples/Basic_Test/applet/WInterrupts.c.o create mode 100644 LoLShield/Examples/Basic_Test/applet/WMath.cpp.o create mode 100644 LoLShield/Examples/Basic_Test/applet/core.a create mode 100644 LoLShield/Examples/Basic_Test/applet/pins_arduino.c.o create mode 100644 LoLShield/Examples/Basic_Test/applet/wiring.c.o create mode 100644 LoLShield/Examples/Basic_Test/applet/wiring_analog.c.o create mode 100644 LoLShield/Examples/Basic_Test/applet/wiring_digital.c.o create mode 100644 LoLShield/Examples/Basic_Test/applet/wiring_pulse.c.o create mode 100644 LoLShield/Examples/Basic_Test/applet/wiring_shift.c.o create mode 100644 LoLShield/Examples/Life/Life.pde create mode 100644 LoLShield/Examples/charli_heart/applet/Charli/Charliplexing.cpp.o create mode 100644 LoLShield/Examples/charli_heart/applet/HardwareSerial.cpp.o create mode 100644 LoLShield/Examples/charli_heart/applet/Print.cpp.o create mode 100644 LoLShield/Examples/charli_heart/applet/WInterrupts.c.o create mode 100644 LoLShield/Examples/charli_heart/applet/WMath.cpp.o create mode 100644 LoLShield/Examples/charli_heart/applet/charli_heart.cpp create mode 100644 LoLShield/Examples/charli_heart/applet/charli_heart.cpp.eep create mode 100644 LoLShield/Examples/charli_heart/applet/charli_heart.cpp.elf create mode 100644 LoLShield/Examples/charli_heart/applet/charli_heart.cpp.hex create mode 100644 LoLShield/Examples/charli_heart/applet/charli_heart.cpp.o create mode 100644 LoLShield/Examples/charli_heart/applet/core.a create mode 100644 LoLShield/Examples/charli_heart/applet/pins_arduino.c.o create mode 100644 LoLShield/Examples/charli_heart/applet/wiring.c.o create mode 100644 LoLShield/Examples/charli_heart/applet/wiring_analog.c.o create mode 100644 LoLShield/Examples/charli_heart/applet/wiring_digital.c.o create mode 100644 LoLShield/Examples/charli_heart/applet/wiring_pulse.c.o create mode 100644 LoLShield/Examples/charli_heart/applet/wiring_shift.c.o create mode 100644 LoLShield/Examples/charli_heart/charli_heart.pde diff --git a/LoLShield/Charliplexing.cpp b/LoLShield/Charliplexing.cpp new file mode 100644 index 0000000..5211a84 --- /dev/null +++ b/LoLShield/Charliplexing.cpp @@ -0,0 +1,185 @@ + /* + Charliplexing.h - Using timer2 with 1ms resolution + + Alex Wenger http://arduinobuch.wordpress.com/ + + Timer init code from MsTimer2 - Javier Valencia + + History: + 30/Dez/09 - V0.0 wrote the first version at 26C3/Berlin + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "WProgram.h" +#include +#include +#include "Charliplexing.h" + + +volatile unsigned int LedSign::tcnt2; + +// Table for the LED multiplexing cycles, containing 12 cycles made out of two bytes +uint8_t leds[24]; + + +// Table for LED Position in leds[] ram table +const uint8_t ledMap[252] = { + 13, 5,13, 6,13, 7,13, 8,13, 9,13,10,13,11,13,12,13, 4, 4,13,13, 3, 3,13,13, 2, 2,13, + 12, 5,12, 6,12, 7,12, 8,12, 9,12,10,12,11,12,13,12, 4, 4,12,12, 3, 3,12,12, 2, 2,12, + 11, 5,11, 6,11, 7,11, 8,11, 9,11,10,11,12,11,13,11, 4, 4,11,11, 3, 3,11,11, 2, 2,11, + 10, 5,10, 6,10, 7,10, 8,10, 9,10,11,10,12,10,13,10, 4, 4,10,10, 3, 3,10,10, 2, 2,10, + 9, 5, 9, 6, 9, 7, 9, 8, 9,10, 9,11, 9,12, 9,13, 9, 4, 4, 9, 9, 3, 3, 9, 9, 2, 2, 9, + 8, 5, 8, 6, 8, 7, 8, 9, 8,10, 8,11, 8,12, 8,13, 8, 4, 4, 8, 8, 3, 3, 8, 8, 2, 2, 8, + 7, 5, 7, 6, 7, 8, 7, 9, 7,10, 7,11, 7,12, 7,13, 7, 4, 4, 7, 7, 3, 3, 7, 7, 2, 2, 7, + 6, 5, 6, 7, 6, 8, 6, 9, 6,10, 6,11, 6,12, 6,13, 6, 4, 4, 6, 6, 3, 3, 6, 6, 2, 2, 6, + 5, 6, 5, 7, 5, 8, 5, 9, 5,10, 5,11, 5,12, 5,13, 5, 4, 4, 5, 5, 3, 3, 5, 5, 2, 2, 5, + }; + + +// Constructor / init interrupt +void LedSign::Init(void) +{ + float prescaler = 0.0; + +#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega328P__) || (__AVR_ATmega1280__) + TIMSK2 &= ~(1<= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64 + TCCR2B |= (1< 16Mhz, prescaler set to 128 + TCCR2B |= ((1<= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64 + TCCR2 |= (1< 16Mhz, prescaler set to 128 + TCCR2 |= ((1<= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64 + TCCR2 |= ((1< 16Mhz, prescaler set to 256 + TCCR2 |= (1< 12) i = 0; + + if (i < 6) { + DDRD = _BV(i+2) | leds[i*2]; + PORTD = leds[i*2]; + + DDRB = leds[i*2+1]; + PORTB = leds[i*2+1]; + } else { + DDRD = leds[i*2]; + PORTD = leds[i*2]; + + DDRB = _BV(i-6) | leds[i*2+1]; + PORTB = leds[i*2+1]; + } + /* + PORTB = 0xff; + PORTD = i; + DDRB = 0xff; + DDRD = 0xff; + */ +} + diff --git a/LoLShield/Charliplexing.h b/LoLShield/Charliplexing.h new file mode 100644 index 0000000..2e1dbf3 --- /dev/null +++ b/LoLShield/Charliplexing.h @@ -0,0 +1,20 @@ +/* + Charliplexing.h - Library for controlling the charliplexed led board + from JimmiePRodgers.com + Created by Alex Wenger, December 30, 2009. + Released into the public domain. +*/ + +#ifndef Charliplexing_h +#define Charliplexing_h + +#include + +namespace LedSign +{ + extern void Init(void); + extern void Set(uint8_t x, uint8_t y, uint8_t c); + extern volatile unsigned int tcnt2; +}; + +#endif diff --git a/LoLShield/Charliplexing.o b/LoLShield/Charliplexing.o new file mode 100644 index 0000000..ebcfc99 Binary files /dev/null and b/LoLShield/Charliplexing.o differ diff --git a/LoLShield/Examples/Basic_Test/Basic_Test.pde b/LoLShield/Examples/Basic_Test/Basic_Test.pde new file mode 100644 index 0000000..a6cd4e8 --- /dev/null +++ b/LoLShield/Examples/Basic_Test/Basic_Test.pde @@ -0,0 +1,172 @@ +/* + Basic LoL Shield Test + + Writen for the LoL Shield, designed by Jimmie Rodgers: + http://jimmieprodgers.com/kits/lolshield/ + + This needs the Charliplexing library, which you can get at the + LoL Shield project page: http://code.google.com/p/lolshield/ + + Created by Jimmie Rodgers on 12/30/2009. + Adapted from: http://www.arduino.cc/playground/Code/BitMath + + History: + December 30, 2009 - V1.0 first version written at 26C3/Berlin + + This is free software; you can redistribute it and/or + modify it under the terms of the GNU Version 3 General Public + License as published by the Free Software Foundation; + or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include //AVR library for writing to ROM +#include //Imports the library, which needs to be + //Initialized in setup. + +int blinkdelay = 100; //Sets the time each frame is shown + +/* +The BitMap array is what contains the frame data. Each line is one full frame. +Since each number is 16 bits, we can easily fit all 14 LEDs per row into it. +The number is calculated by adding up all the bits, starting with lowest on +the left of each row. 18000 was chosen as the kill number, so make sure that +is at the end of the matrix, or the program will continue to read into memory. + +Here PROGMEM is called, which stores the array into ROM, which leaves us +with our RAM. You cannot change the array during run-time, only when you +upload to the Arduino. You will need to pull it out of ROM, which is covered +below. If you want it to stay in RAM, just delete PROGMEM +*/ +uint16_t BitMap[][9] PROGMEM = { +//Diaganal swipe across the screen +{1, 0, 0, 0, 0, 0, 0, 0, 0}, +{3, 1, 0, 0, 0, 0, 0, 0, 0}, +{7, 3, 1, 0, 0, 0, 0, 0, 0}, +{15, 7, 3, 1, 0, 0, 0, 0, 0}, +{31, 15, 7, 3, 1, 0, 0, 0, 0}, +{63, 31, 15, 7, 3, 1, 0, 0, 0}, +{127, 63, 31, 15, 7, 3, 1, 0, 0}, +{255, 127, 63, 31, 15, 7, 3, 1, 0}, +{511, 255, 127, 63, 31, 15, 7, 3, 1}, +{1023, 511, 255, 127, 63, 31, 15, 7, 3}, +{2047, 1023, 511, 255, 127, 63, 31, 15, 7}, +{4095, 2047, 1023, 511, 255, 127, 63, 31, 15}, +{8191, 4095, 2047, 1023, 511, 255, 127, 63, 31}, +{16383, 8191, 4095, 2047, 1023, 511, 255, 127, 63}, +{16383, 16383, 8191, 4095, 2047, 1023, 511, 255, 127}, +{16383, 16383, 16383, 8191, 4095, 2047, 1023, 511, 255}, +{16383, 16383, 16383, 16383, 8191, 4095, 2047, 1023, 511}, +{16383, 16383, 16383, 16383, 16383, 8191, 4095, 2047, 1023}, +{16383, 16383, 16383, 16383, 16383, 16383, 8191, 4095, 2047}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 8191, 4095}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 8191}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16382, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16380, 16382, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16376, 16380, 16382, 16383, 16383, 16383, 16383, 16383, 16383}, +{16368, 16376, 16380, 16382, 16383, 16383, 16383, 16383, 16383}, +{16352, 16368, 16376, 16380, 16382, 16383, 16383, 16383, 16383}, +{16320, 16352, 16368, 16376, 16380, 16382, 16383, 16383, 16383}, +{16256, 16320, 16352, 16368, 16376, 16380, 16382, 16383, 16383}, +{16128, 16256, 16320, 16352, 16368, 16376, 16380, 16382, 16383}, +{15872, 16128, 16256, 16320, 16352, 16368, 16376, 16380, 16382}, +{15360, 15872, 16128, 16256, 16320, 16352, 16368, 16376, 16380}, +{14336, 15360, 15872, 16128, 16256, 16320, 16352, 16368, 16376}, +{12288, 14336, 15360, 15872, 16128, 16256, 16320, 16352, 16368}, +{8192, 12288, 14336, 15360, 15872, 16128, 16256, 16320, 16352}, +{0, 8192, 12288, 14336, 15360, 15872, 16128, 16256, 16320}, +{0, 0, 8192, 12288, 14336, 15360, 15872, 16128, 16256}, +{0, 0, 0, 8192, 12288, 14336, 15360, 15872, 16128}, +{0, 0, 0, 0, 8192, 12288, 14336, 15360, 15872}, +{0, 0, 0, 0, 0, 8192, 12288, 14336, 15360}, +{0, 0, 0, 0, 0, 0, 8192, 12288, 14336}, +{0, 0, 0, 0, 0, 0, 0, 8192, 12288}, +{0, 0, 0, 0, 0, 0, 0, 0, 8192}, +{0, 0, 0, 0, 0, 0, 0, 0, 0}, + +//Horizontal swipe +{1, 1, 1, 1, 1, 1, 1, 1, 1} , +{3, 3, 3, 3, 3, 3, 3, 3, 3}, +{7, 7, 7, 7, 7, 7, 7, 7, 7}, +{15, 15, 15, 15, 15, 15, 15, 15, 15}, +{31, 31, 31, 31, 31, 31, 31, 31, 31}, +{63, 63, 63, 63, 63, 63, 63, 63, 63}, +{127, 127, 127, 127, 127, 127, 127, 127, 127}, +{255, 255, 255, 255, 255, 255, 255, 255, 255}, +{511, 511, 511, 511, 511, 511, 511, 511, 511}, +{1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023}, +{2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047}, +{4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095}, +{8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382}, +{16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380}, +{16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376}, +{16368, 16368, 16368, 16368, 16368, 16368, 16368, 16368, 16368}, +{16352, 16352, 16352, 16352, 16352, 16352, 16352, 16352, 16352}, +{16320, 16320, 16320, 16320, 16320, 16320, 16320, 16320, 16320}, +{16256, 16256, 16256, 16256, 16256, 16256, 16256, 16256, 16256}, +{16128, 16128, 16128, 16128, 16128, 16128, 16128, 16128, 16128}, +{15872, 15872, 15872, 15872, 15872, 15872, 15872, 15872, 15872}, +{15360, 15360, 15360, 15360, 15360, 15360, 15360, 15360, 15360}, +{14336, 14336, 14336, 14336, 14336, 14336, 14336, 14336, 14336}, +{12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288}, +{8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192}, +{0, 0, 0, 0, 0, 0, 0, 0, 0}, +{18000} +}; + +void setup() { + LedSign::Init(); //Initializes the screen +} +void loop() { + DisplayBitMap(); //Displays the bitmap +} + +void DisplayBitMap() +{ + boolean run=true; //While this is true, the screen updates + byte frame = 0; //Frame counter + byte line = 0; //Row counter + unsigned long data; //Temporary storage of the row data + + while(run == true) { + for(line = 0; line < 9; line++) { + + //Here we fetch data from program memory with a pointer. + data = pgm_read_word_near (&BitMap[frame][line]); + + //Kills the loop if the kill number is found + if (data==18000){ + run=false; + } + + //This is where the bit-shifting happens to pull out + //each LED from a row. If the bit is 1, then the LED + //is turned on, otherwise it is turned off. + else for (byte led=0; led<14; ++led) { + if (data & (1< //AVR library for writing to ROM +#include //Imports the library, which needs to be + //Initialized in setup. + +#include "WProgram.h" +void setup(); +void loop(); +void DisplayBitMap(); +int blinkdelay = 100; //Sets the time each frame is shown + +/* +The BitMap array is what contains the frame data. Each line is one full frame. +Since each number is 16 bits, we can easily fit all 14 LEDs per row into it. +The number is calculated by adding up all the bits, starting with lowest on +the left of each row. 18000 was chosen as the kill number, so make sure that +is at the end of the matrix, or the program will continue to read into memory. + +Here PROGMEM is called, which stores the array into ROM, which leaves us +with our RAM. You cannot change the array during run-time, only when you +upload to the Arduino. You will need to pull it out of ROM, which is covered +below. If you want it to stay in RAM, just delete PROGMEM +*/ +uint16_t BitMap[][9] PROGMEM = { +//Diaganal swipe across the screen +{1, 0, 0, 0, 0, 0, 0, 0, 0}, +{3, 1, 0, 0, 0, 0, 0, 0, 0}, +{7, 3, 1, 0, 0, 0, 0, 0, 0}, +{15, 7, 3, 1, 0, 0, 0, 0, 0}, +{31, 15, 7, 3, 1, 0, 0, 0, 0}, +{63, 31, 15, 7, 3, 1, 0, 0, 0}, +{127, 63, 31, 15, 7, 3, 1, 0, 0}, +{255, 127, 63, 31, 15, 7, 3, 1, 0}, +{511, 255, 127, 63, 31, 15, 7, 3, 1}, +{1023, 511, 255, 127, 63, 31, 15, 7, 3}, +{2047, 1023, 511, 255, 127, 63, 31, 15, 7}, +{4095, 2047, 1023, 511, 255, 127, 63, 31, 15}, +{8191, 4095, 2047, 1023, 511, 255, 127, 63, 31}, +{16383, 8191, 4095, 2047, 1023, 511, 255, 127, 63}, +{16383, 16383, 8191, 4095, 2047, 1023, 511, 255, 127}, +{16383, 16383, 16383, 8191, 4095, 2047, 1023, 511, 255}, +{16383, 16383, 16383, 16383, 8191, 4095, 2047, 1023, 511}, +{16383, 16383, 16383, 16383, 16383, 8191, 4095, 2047, 1023}, +{16383, 16383, 16383, 16383, 16383, 16383, 8191, 4095, 2047}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 8191, 4095}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 8191}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16382, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16380, 16382, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16376, 16380, 16382, 16383, 16383, 16383, 16383, 16383, 16383}, +{16368, 16376, 16380, 16382, 16383, 16383, 16383, 16383, 16383}, +{16352, 16368, 16376, 16380, 16382, 16383, 16383, 16383, 16383}, +{16320, 16352, 16368, 16376, 16380, 16382, 16383, 16383, 16383}, +{16256, 16320, 16352, 16368, 16376, 16380, 16382, 16383, 16383}, +{16128, 16256, 16320, 16352, 16368, 16376, 16380, 16382, 16383}, +{15872, 16128, 16256, 16320, 16352, 16368, 16376, 16380, 16382}, +{15360, 15872, 16128, 16256, 16320, 16352, 16368, 16376, 16380}, +{14336, 15360, 15872, 16128, 16256, 16320, 16352, 16368, 16376}, +{12288, 14336, 15360, 15872, 16128, 16256, 16320, 16352, 16368}, +{8192, 12288, 14336, 15360, 15872, 16128, 16256, 16320, 16352}, +{0, 8192, 12288, 14336, 15360, 15872, 16128, 16256, 16320}, +{0, 0, 8192, 12288, 14336, 15360, 15872, 16128, 16256}, +{0, 0, 0, 8192, 12288, 14336, 15360, 15872, 16128}, +{0, 0, 0, 0, 8192, 12288, 14336, 15360, 15872}, +{0, 0, 0, 0, 0, 8192, 12288, 14336, 15360}, +{0, 0, 0, 0, 0, 0, 8192, 12288, 14336}, +{0, 0, 0, 0, 0, 0, 0, 8192, 12288}, +{0, 0, 0, 0, 0, 0, 0, 0, 8192}, +{0, 0, 0, 0, 0, 0, 0, 0, 0}, + +//Horizontal swipe +{1, 1, 1, 1, 1, 1, 1, 1, 1} , +{3, 3, 3, 3, 3, 3, 3, 3, 3}, +{7, 7, 7, 7, 7, 7, 7, 7, 7}, +{15, 15, 15, 15, 15, 15, 15, 15, 15}, +{31, 31, 31, 31, 31, 31, 31, 31, 31}, +{63, 63, 63, 63, 63, 63, 63, 63, 63}, +{127, 127, 127, 127, 127, 127, 127, 127, 127}, +{255, 255, 255, 255, 255, 255, 255, 255, 255}, +{511, 511, 511, 511, 511, 511, 511, 511, 511}, +{1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023}, +{2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047}, +{4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095}, +{8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382}, +{16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380}, +{16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376}, +{16368, 16368, 16368, 16368, 16368, 16368, 16368, 16368, 16368}, +{16352, 16352, 16352, 16352, 16352, 16352, 16352, 16352, 16352}, +{16320, 16320, 16320, 16320, 16320, 16320, 16320, 16320, 16320}, +{16256, 16256, 16256, 16256, 16256, 16256, 16256, 16256, 16256}, +{16128, 16128, 16128, 16128, 16128, 16128, 16128, 16128, 16128}, +{15872, 15872, 15872, 15872, 15872, 15872, 15872, 15872, 15872}, +{15360, 15360, 15360, 15360, 15360, 15360, 15360, 15360, 15360}, +{14336, 14336, 14336, 14336, 14336, 14336, 14336, 14336, 14336}, +{12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288}, +{8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192}, +{0, 0, 0, 0, 0, 0, 0, 0, 0}, +{18000} +}; + +void setup() { + LedSign::Init(); //Initializes the screen +} +void loop() { + DisplayBitMap(); //Displays the bitmap +} + +void DisplayBitMap() +{ + boolean run=true; //While this is true, the screen updates + byte frame = 0; //Frame counter + byte line = 0; //Row counter + unsigned long data; //Temporary storage of the row data + + while(run == true) { + for(line = 0; line < 9; line++) { + + //Here we fetch data from program memory with a pointer. + data = pgm_read_word_near (&BitMap[frame][line]); + + //Kills the loop if the kill number is found + if (data==18000){ + run=false; + } + + //This is where the bit-shifting happens to pull out + //each LED from a row. If the bit is 1, then the LED + //is turned on, otherwise it is turned off. + else for (byte led=0; led<14; ++led) { + if (data & (1< //Imports the library, which needs to be + //Initialized in setup. + +#define DELAY 150 //Sets the time each generation is shown +#define RESEEDRATE 5000 //Sets the rate the world is re-seeded +#define SIZEX 14 //Sets the X axis size +#define SIZEY 9 //Sets the Y axis size +byte world[SIZEX][SIZEY][2]; //Creates a double buffer world +long density = 50; //Sets density % during seeding +int geck = 0; //Counter for re-seeding + +void setup() { + LedSign::Init(); //Initilizes the LoL Shield + randomSeed(analogRead(5)); + //Builds the world with an initial seed. + for (int i = 0; i < SIZEX; i++) { + for (int j = 0; j < SIZEY; j++) { + if (random(100) < density) { + world[i][j][0] = 1; + } + else { + world[i][j][0] = 0; + } + world[i][j][1] = 0; + } + } +} + +void loop() { + // Birth and death cycle + for (int x = 0; x < SIZEX; x++) { + for (int y = 0; y < SIZEY; y++) { + // Default is for cell to stay the same + world[x][y][1] = world[x][y][0]; + int count = neighbours(x, y); + geck++; + if (count == 3 && world[x][y][0] == 0) { + // A new cell is born + world[x][y][1] = 1; + LedSign::Set(x,y,1); + } + else if ((count < 2 || count > 3) && world[x][y][0] == 1) { + // Cell dies + world[x][y][1] = 0; + LedSign::Set(x,y,0); + } + } + + } + + //Counts and then checks for re-seeding + //Otherwise the display will die out at some point + geck++; + if (geck > RESEEDRATE){ + seedWorld(); + geck = 0; + } + + // Copy next generation into place + for (int x = 0; x < SIZEX; x++) { + for (int y = 0; y < SIZEY; y++) { + world[x][y][0] = world[x][y][1]; + } + } + delay(DELAY); +} + +//Re-seeds based off of RESEEDRATE +void seedWorld(){ + randomSeed(analogRead(5)); + for (int i = 0; i < SIZEX; i++) { + for (int j = 0; j < SIZEY; j++) { + if (random(100) < density) { + world[i][j][1] = 1; + } + } + } +} + +//Runs the rule checks, including screen wrap +int neighbours(int x, int y) { + return world[(x + 1) % SIZEX][y][0] + + world[x][(y + 1) % SIZEY][0] + + world[(x + SIZEX - 1) % SIZEX][y][0] + + world[x][(y + SIZEY - 1) % SIZEY][0] + + world[(x + 1) % SIZEX][(y + 1) % SIZEY][0] + + world[(x + SIZEX - 1) % SIZEX][(y + 1) % SIZEY][0] + + world[(x + SIZEX - 1) % SIZEX][(y + SIZEY - 1) % SIZEY][0] + + world[(x + 1) % SIZEX][(y + SIZEY - 1) % SIZEY][0]; +} diff --git a/LoLShield/Examples/charli_heart/applet/Charli/Charliplexing.cpp.o b/LoLShield/Examples/charli_heart/applet/Charli/Charliplexing.cpp.o new file mode 100644 index 0000000..c886fbc Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/Charli/Charliplexing.cpp.o differ diff --git a/LoLShield/Examples/charli_heart/applet/HardwareSerial.cpp.o b/LoLShield/Examples/charli_heart/applet/HardwareSerial.cpp.o new file mode 100644 index 0000000..392863d Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/HardwareSerial.cpp.o differ diff --git a/LoLShield/Examples/charli_heart/applet/Print.cpp.o b/LoLShield/Examples/charli_heart/applet/Print.cpp.o new file mode 100644 index 0000000..8e1cd86 Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/Print.cpp.o differ diff --git a/LoLShield/Examples/charli_heart/applet/WInterrupts.c.o b/LoLShield/Examples/charli_heart/applet/WInterrupts.c.o new file mode 100644 index 0000000..3693449 Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/WInterrupts.c.o differ diff --git a/LoLShield/Examples/charli_heart/applet/WMath.cpp.o b/LoLShield/Examples/charli_heart/applet/WMath.cpp.o new file mode 100644 index 0000000..c44ea10 Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/WMath.cpp.o differ diff --git a/LoLShield/Examples/charli_heart/applet/charli_heart.cpp b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp new file mode 100644 index 0000000..4d227cc --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp @@ -0,0 +1,99 @@ +/* + Example for Charliplexing library + + Alex Wenger http://arduinobuch.wordpress.com/ + + History: + 30/Dez/09 - V0.0 wrote the first version at 26C3/Berlin + +*/ +#include "Charliplexing.h" + +#include "WProgram.h" +void setup(); +void heart(); +void loop(); +struct point { + uint8_t xp; // Point Position in X direction (multplied by 16) + uint8_t x_speed; // Speed + uint8_t flag; +} points[9]; + +void setup() // run once, when the sketch starts +{ + LedSign::Init(); + + for(uint8_t i = 0; i < 9; i++) + { + points[i].xp = 0; + points[i].x_speed = random(1, 16); + points[i].flag = 1; + } +} + +uint8_t heart_p[] = { + 4,5, + 3,4, + 2,4, + 5,4, + 6,4, + 7,5, + 1,5, + 7,6, + 1,6, + 6,7, + 2,7, + 5,8, + 3,8, + 4,9, +}; + +void heart() +{ + for(uint8_t y = 0; y < 9; y++) + for(uint8_t x = 3; x < 11; x++) + { + LedSign::Set(x,y,0); + } + for(uint8_t i = 0; i < 14; i++) + { + LedSign::Set(heart_p[i*2+1],heart_p[i*2],1); + } +} + +uint8_t heart_flag; + +void loop() // run over and over again +{ + for(uint8_t i = 0; i < 9; i++) + { + points[i].xp += points[i].x_speed; + if (points[i].xp >= 14*16) + { + points[i].x_speed = random(1, 16); + points[i].xp = 0; + points[i].flag ^= 1; + } + LedSign::Set(points[i].xp/16,i,points[i].flag); + } + + heart_flag++; + if (heart_flag < 20) { + heart(); + } + + delay(40); +} + +int main(void) +{ + init(); + + setup(); + + for (;;) + loop(); + + return 0; +} + diff --git a/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.eep b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.eep new file mode 100644 index 0000000..1996e8f --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.elf b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.elf new file mode 100644 index 0000000..ac6a500 Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.elf differ diff --git a/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.hex b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.hex new file mode 100644 index 0000000..cb8a859 --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.hex @@ -0,0 +1,148 @@ +:100000000C9434000C9451000C9451000C94510049 +:100010000C9451000C9451000C9451000C9451001C +:100020000C9451000C9426010C9451000C94510036 +:100030000C9451000C9451000C9451000C945100FC +:100040000C9403020C9451000C9451000C94510038 +:100050000C9451000C9451000C9451000C945100DC +:100060000C9451000C94510011241FBECFEFD8E026 +:10007000DEBFCDBF13E0A0E0B1E0E8E0F7E002C0F2 +:1000800005900D92A831B107D9F713E0A8E1B3E0CC +:1000900001C01D92A835B107E1F70E94FC010C9444 +:1000A00082030C940000A0E0B0E0E9E5F0E00C94DD +:1000B0005303EC01A880B980CA80DB80A114B1048D +:1000C000C104D10441F484E2A82E89EDB82E8BE559 +:1000D000C82E87E0D82EC601B5012DE133EF41E0EF +:1000E00050E00E940E0327EA31E440E050E00E9415 +:1000F000EF027B018C01C601B5012DE133EF41E038 +:1001000050E00E940E03CA01B9012CEE34EF4FEF0C +:100110005FEF0E94EF026E0D7F1D801F911F97FF02 +:1001200004C06150704080409048688379838A831E +:100130009B839B01AC015F77B901CA01CDB7DEB7E4 +:10014000EAE00C946F030E945300089580E091E070 +:100150000E94530008956093000170930101809301 +:10016000020190930301089520E730E0F9018081B6 +:100170008E7F8083E0EBF0E080818C7F8083A1EB39 +:10018000B0E08C91877F8C93E6EBF0E080818F7DEF +:100190008083F90180818D7F80838C9184608C9332 +:1001A0008C918C7F8C9386E090E0909319038093E0 +:1001B000180380911803909119038093B2008081F5 +:1001C0008160808308959EE0699FF0011124E80F0B +:1001D000F11DEE0FFF1FEE0FFF1FDF01AE5DBE4FE3 +:1001E0009C91E05EFE4F8081E92FF0E0982F96957C +:1001F00096959695282F30E0413099F43297EE0F7E +:10020000FF1FE90FF11DE65EFC4F2770307081E0A3 +:1002100090E002C0880F991F2A95E2F72081282BD1 +:1002200013C03297EE0FFF1FE90FF11DE65EFC4F82 +:100230002770307081E090E002C0880F991F2A95E6 +:10024000E2F7809520812823208308951F920F9242 +:100250000FB60F9211242F934F935F938F939F9319 +:10026000EF93FF9380911803909119038093B2004C +:10027000809132038F5F809332038D3010F01092A3 +:10028000320380913203482F50E08630B0F4FA01F7 +:10029000EE0FFF1FE65EFC4F20814E5F5F4F81E057 +:1002A00090E002C0880F991F4A95E2F7822B8AB925 +:1002B0002BB9818184B985B915C0FA01EE0FFF1FF2 +:1002C000E65EFC4F80818AB98BB92181465050404F +:1002D00081E090E002C0880F991F4A95E2F7822BD7 +:1002E00084B925B9FF91EF919F918F915F914F91C3 +:1002F0002F910F900FBE0F901F9018950F931F9383 +:10030000CF93DF9300E00BC0812F602F40E00E946D +:10031000E3001F5F1B30C1F70F5F093011F013E0DE +:10032000F3CFC4E0D1E08981688141E00E94E3001D +:10033000229681E0C032D807B1F7DF91CF911F91AB +:100340000F9108950F931F93CF93DF93C3E3D3E0EF +:1003500010E001E089819881890F8883803E78F0E0 +:1003600061E070E080E090E020E130E040E050E0CB +:100370000E94D102698318828A8180278A838881BA +:1003800082958F70612F4A810E94E3001F5F239640 +:10039000193001F780914E038F5F80934E038431B3 +:1003A00010F40E947E0168E270E080E090E00E941C +:1003B0004B02DF91CF911F910F9108951F93CF931F +:1003C000DF930E94B400C3E3D3E011E0188261E040 +:1003D00070E080E090E020E130E040E050E00E94FA +:1003E000D10269831A83239683E0CE34D80771F74C +:1003F000DF91CF911F9108950E9475020E94DE0146 +:100400000E94A201FDCF1F920F920FB60F921124EE +:100410002F933F938F939F93AF93BF9380915303F9 +:1004200090915403A0915503B09156033091570316 +:100430000196A11DB11D232F2D5F2D3720F02D57C3 +:100440000196A11DB11D20935703809353039093F0 +:100450005403A0935503B093560380914F0390919A +:100460005003A0915103B09152030196A11DB11DFB +:1004700080934F0390935003A0935103B093520382 +:10048000BF91AF919F918F913F912F910F900FBE90 +:100490000F901F901895EF92FF920F931F937B017F +:1004A0008C018FB7F894409153035091540360919D +:1004B0005503709156038FBF2FB7F8948091530363 +:1004C00090915403A0915503B09156032FBF841B04 +:1004D000950BA60BB70BE816F9060A071B0760F782 +:1004E0001F910F91FF90EF900895789484B58260EA +:1004F00084BD84B5816084BD85B5826085BD85B5C8 +:10050000816085BDEEE6F0E0808181608083E1E876 +:10051000F0E0808182608083808181608083E0E878 +:10052000F0E0808181608083E1EBF0E08081846095 +:100530008083E0EBF0E0808181608083EAE7F0E097 +:1005400080818460808380818260808380818160FB +:1005500080838081806880831092C1000895EF922B +:10056000FF920F931F937B018C016115710581052B +:10057000910529F420E030E040E050E00BC00E94FB +:10058000A600A80197010E940E03AC01CB01DA017D +:100590009C01AD01B901CA011F910F91FF90EF902D +:1005A0000895EF92FF920F931F937B018C016217C6 +:1005B00073078407950764F4261B370B480B590B08 +:1005C000CA01B9010E94AF02E60EF71E081F191FEB +:1005D000B701C8011F910F91FF90EF900895629F9E +:1005E000D001739FF001829FE00DF11D649FE00D2B +:1005F000F11D929FF00D839FF00D749FF00D659F8C +:10060000F00D9927729FB00DE11DF91F639FB00D8A +:10061000E11DF91FBD01CF011124089597FB092E9B +:1006200005260ED057FD04D014D00AD0001C38F493 +:1006300050954095309521953F4F4F4F5F4F08950E +:10064000F6F790958095709561957F4F8F4F9F4FEE +:100650000895A1E21A2EAA1BBB1BFD010DC0AA1F03 +:10066000BB1FEE1FFF1FA217B307E407F50720F01B +:10067000A21BB30BE40BF50B661F771F881F991F96 +:100680001A9469F760957095809590959B01AC01DF +:10069000BD01CF0108952F923F924F925F926F92CA +:1006A0007F928F929F92AF92BF92CF92DF92EF9202 +:1006B000FF920F931F93CF93DF93CDB7DEB7CA1B83 +:1006C000DB0B0FB6F894DEBF0FBECDBF09942A88AE +:1006D000398848885F846E847D848C849B84AA8456 +:1006E000B984C884DF80EE80FD800C811B81AA81E3 +:1006F000B981CE0FD11D0FB6F894DEBF0FBECDBFAE +:08070000ED010895F894FFCF0C +:1007080001000000040503040204050406040705AB +:10071800010507060106060702070508030804097C +:100728000D0005000D0006000D0007000D00080073 +:100738000D0009000D000A000D000B000D000C0053 +:100748000D00040004000D000D00030003000D005F +:100758000D00020002000D000C0005000C00060050 +:100768000C0007000C0008000C0009000C000A002F +:100778000C000B000C000D000C00040004000C0021 +:100788000C00030003000C000C00020002000C0027 +:100798000B0005000B0006000B0007000B0008000B +:1007A8000B0009000B000A000B000C000B000D00E9 +:1007B8000B00040004000B000B00030003000B00F7 +:1007C8000B00020002000B000A0005000A000600E8 +:1007D8000A0007000A0008000A0009000A000B00C6 +:1007E8000A000C000A000D000A00040004000A00B8 +:1007F8000A00030003000A000A00020002000A00BF +:1008080009000500090006000900070009000800A2 +:1008180009000A0009000B0009000C0009000D007E +:10082800090004000400090009000300030009008E +:10083800090002000200090008000500080006007F +:10084800080007000800090008000A0008000B005B +:1008580008000C0008000D0008000400040008004F +:100868000800030003000800080002000200080056 +:100878000700050007000600070008000700090038 +:1008880007000A0007000B0007000C0007000D0016 +:100898000700040004000700070003000300070026 +:1008A8000700020002000700060005000600070016 +:1008B800060008000600090006000A0006000B00F2 +:1008C80006000C0006000D000600040004000600E7 +:1008D80006000300030006000600020002000600EE +:1008E80005000600050007000500080005000900CE +:1008F80005000A0005000B0005000C0005000D00AE +:1009080005000400040005000500030003000500BD +:080918000500020002000500C9 +:00000001FF diff --git a/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.o b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.o new file mode 100644 index 0000000..866a71e Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.o differ diff --git a/LoLShield/Examples/charli_heart/applet/core.a b/LoLShield/Examples/charli_heart/applet/core.a new file mode 100644 index 0000000..55c27ce Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/core.a differ diff --git a/LoLShield/Examples/charli_heart/applet/pins_arduino.c.o b/LoLShield/Examples/charli_heart/applet/pins_arduino.c.o new file mode 100644 index 0000000..97f5b31 Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/pins_arduino.c.o differ diff --git a/LoLShield/Examples/charli_heart/applet/wiring.c.o b/LoLShield/Examples/charli_heart/applet/wiring.c.o new file mode 100644 index 0000000..8629116 Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/wiring.c.o differ diff --git a/LoLShield/Examples/charli_heart/applet/wiring_analog.c.o b/LoLShield/Examples/charli_heart/applet/wiring_analog.c.o new file mode 100644 index 0000000..83850ca Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/wiring_analog.c.o differ diff --git a/LoLShield/Examples/charli_heart/applet/wiring_digital.c.o b/LoLShield/Examples/charli_heart/applet/wiring_digital.c.o new file mode 100644 index 0000000..b66890d Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/wiring_digital.c.o differ diff --git a/LoLShield/Examples/charli_heart/applet/wiring_pulse.c.o b/LoLShield/Examples/charli_heart/applet/wiring_pulse.c.o new file mode 100644 index 0000000..5d4222a Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/wiring_pulse.c.o differ diff --git a/LoLShield/Examples/charli_heart/applet/wiring_shift.c.o b/LoLShield/Examples/charli_heart/applet/wiring_shift.c.o new file mode 100644 index 0000000..f998551 Binary files /dev/null and b/LoLShield/Examples/charli_heart/applet/wiring_shift.c.o differ diff --git a/LoLShield/Examples/charli_heart/charli_heart.pde b/LoLShield/Examples/charli_heart/charli_heart.pde new file mode 100644 index 0000000..0847dfd --- /dev/null +++ b/LoLShield/Examples/charli_heart/charli_heart.pde @@ -0,0 +1,82 @@ +/* + Example for Charliplexing library + + Alex Wenger http://arduinobuch.wordpress.com/ + + History: + 30/Dez/09 - V0.0 wrote the first version at 26C3/Berlin + +*/ +#include "Charliplexing.h" + +struct point { + uint8_t xp; // Point Position in X direction (multplied by 16) + uint8_t x_speed; // Speed + uint8_t flag; +} points[9]; + +void setup() // run once, when the sketch starts +{ + LedSign::Init(); + + for(uint8_t i = 0; i < 9; i++) + { + points[i].xp = 0; + points[i].x_speed = random(1, 16); + points[i].flag = 1; + } +} + +uint8_t heart_p[] = { + 4,5, + 3,4, + 2,4, + 5,4, + 6,4, + 7,5, + 1,5, + 7,6, + 1,6, + 6,7, + 2,7, + 5,8, + 3,8, + 4,9, +}; + +void heart() +{ + for(uint8_t y = 0; y < 9; y++) + for(uint8_t x = 3; x < 11; x++) + { + LedSign::Set(x,y,0); + } + for(uint8_t i = 0; i < 14; i++) + { + LedSign::Set(heart_p[i*2+1],heart_p[i*2],1); + } +} + +uint8_t heart_flag; + +void loop() // run over and over again +{ + for(uint8_t i = 0; i < 9; i++) + { + points[i].xp += points[i].x_speed; + if (points[i].xp >= 14*16) + { + points[i].x_speed = random(1, 16); + points[i].xp = 0; + points[i].flag ^= 1; + } + LedSign::Set(points[i].xp/16,i,points[i].flag); + } + + heart_flag++; + if (heart_flag < 20) { + heart(); + } + + delay(40); +} -- cgit v1.2.3