1
0
Fork 0

initial commit

This commit is contained in:
Eve Entropia 2010-03-30 18:55:18 +02:00
commit 617bdc2d29
281 changed files with 5698 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

View file

@ -0,0 +1,234 @@
#include <avr/pgmspace.h>
/*
Arduino Desc DB-25 Pin
======= ==== =========
GND GND 18-25
13 BUSY 11
12 nACK 10
11 D7 9
10 D6 8
9 D5 7
8 D4 6
7 D3 5
6 D2 4
5 D1 3
4 D0 2
3 nSTROBE 1
*/
int PIN_nSTROBE = 3;
int PIN_nACK = 12;
int PIN_BUSY = 13;
PROGMEM char porn[] =
"\r\n"
"\r\n"
" sexsexsexsexsexse\r\n"
" sexsesexsexsexsexsexs\r\n"
" sexsexsexsexsexsexsexse\r\n"
" sexsexsexsexsexsexsexsexsex\r\n"
" sexsexsexsexsexsexsexsexsexsex\r\n"
" sexsexsexsexsexsexsexsexsexsexs\r\n"
" sexsexsexsexsexsexsexsexsexsexsex\r\n"
" sexsexsexsexsexsexsexsexsexsexsexse\r\n"
" sexsexsexsexsexsexsexsexsexsexsexsex\r\n"
" exsexsexsexsexsexsexsex sexsexsexsex\r\n"
" sexsexsexsexsexsexsexs sexsexsexse\r\n"
" sexsexsexsexsexsexsex sexsexsex\r\n"
" sexsexsexsexsexsex sexsexsx\r\n"
" sexsexsexsexsexx sexsexs x\r\n"
" sexsexsexsexsex-****. .***-sexsexs sexs\r\n"
" sexsexsexsexsex sexsex sexsexs\r\n"
" sexsexsexsexsex sexsex sexsexsexs\r\n"
" sexsexsexsexsex sexse sexsexsexse\r\n"
" sesexsexsexsexs --sexsex- sexse sexsexsexse\r\n"
" xsexsexsexsexse sexs sexse sexsexsexs\r\n"
" sexsexsexsexsexse sexse sexsexsexse\r\n"
" sexsexsexsexsexsexs sexse sexsexse\r\n"
" sexsexse sexsexs ixx sexse\r\n"
" sexsex sexsexs i sex\r\n"
" sexs sexsexs i x\r\n"
" sex sexsex x x\r\n"
" x sexsex x x\r\n"
" x sexse xx\r\n"
" sex sex x\r\n"
" sexsexs xx x\r\n"
" sexsexsex x x x x\r\n"
" sexsexsexsexse x (o\r\n"
" sexsexsexsexse x x\r\n"
" sexsexsexsexse x x (o) x x\r\n"
" sexsexsexsexse x x x x\r\n"
" sexsexsexsex x x x x\r\n"
" sexsexsexsex x x x xx\r\n"
" sexsexsexse x x x x\r\n"
" sexsexsexse x x x x x\r\n"
" sexsexsexs x x\r\n"
" sexsexsexs x x\r\n"
" sexsexsex x x\r\n"
" sexsexsex x x\r\n"
" sexsexsex x x\r\n"
" sexsexse x x\r\n"
" sexsexse x x\r\n"
" sexsexs x x\r\n"
" sexsex sexsexse x x\r\n"
" sexsexsexsexsexs x\r\n"
" sexsexsexsexse x\r\n"
" sexsexsexsex o x\r\n"
" sexsex x\r\n"
" x x\r\n"
" x x\r\n"
" x x\r\n"
" x Y x\r\n"
" x x x\r\n"
" x x x\r\n"
" x x x\r\n"
" x sexsexsex x\r\n"
" x sexsexsexsexsx exsex\r\n"
" x sexsexsexsexsexs sexx\r\n"
" x sexsexsexsexsexsexs xx\r\n"
" x sexsexsexsexsexsexse x\r\n"
" x sexsexsexsexsexsexsexs\r\n"
" x sexsexsexsexsexsexsexse\r\n"
" sexsexsexsexsexsexsexsex\r\n"
" sexsexsexsexsexsexsexse\r\n"
" x sexsexsexsexsexsexsexs\r\n"
" xx sexsexsexsexsexsexsexs\r\n"
" sex sexsexsexsexsexsexsex\r\n"
" sex sexsexsexsexsexsexse\r\n"
" sexs sexsexsexsexsexsexs\r\n"
" sexse sexsexsexsexsexse\r\n"
" sexsex sexsexsexsexsexse\r\n"
" sexsex sexsexsexsexsexs\r\n"
" sexsexs sexsexsexsexsex\r\n"
" sexsexs sexsexsexsexse\r\n"
" sexsexse sexsexsexsexs\r\n"
" sexsexsex sexsexsexsex\r\n"
" sexsexsexs sexsexsexse\r\n"
" sexsexsexs sexsexsexse\r\n"
" sexsexsexse sexsexsexs\r\n"
" sexsexsexs sexsexsexse\r\n"
" sexsexsexse sexsexsexse\r\n"
" sexsexsexse sexsexsexse\r\n"
" sexsexsexse sexsexsexs\r\n"
" sexsexsexse sexsexsexse\r\n"
" sexsexsexsex sexsexsexse\r\n"
" sexsexsexsex sexsexsexse\r\n"
" sexsexsexsex sexsexsexsex\r\n"
" sexsexsexse sexsexsexsex\r\n"
" sexsexsexse sexsexsexsex\r\n"
" sexsexsexs sexsexsexsex\r\n"
" sexsexsexs sexsexsexse\r\n"
" sexsexsex sexsexsexse\r\n"
" sexsexse sexsexsexs\r\n"
" sexsexse sexsexsex\r\n"
" sexsexs sexsexse\r\n"
" sexsex sexsexs\r\n"
" sexsex sexsexs\r\n"
" sexsex sexsex\r\n"
" exsex sexse\r\n"
" sexsex sexsex\r\n"
" sexsex sexsex\r\n"
" sexsexs sexsexx\r\n"
" sexsexsex sexsexse\r\n"
" sexsexsexse sexsexsexse\r\n"
" sexsexsexsexs sexsexsexsex\r\n"
" sexsexsexsexse sexsexsexsex\r\n"
" sex sexsexsex sexsexsexsex\r\n"
" x sexsexse xx sexsexse\r\n"
" x sexsex\r\n"
" sexse\r\n"
" sexse\r\n"
" sexse\r\n"
" sex\r\n"
" xx\r\n"
" xx\r\n"
"\r\n"
;
void setup() {
int i;
for( i = 3; i <= 11; i++ ) {
pinMode (i, OUTPUT);
digitalWrite(i, LOW);
}
digitalWrite(PIN_nSTROBE, HIGH);
pinMode (PIN_nACK, INPUT);
pinMode (PIN_BUSY, INPUT);
// DEBUG
Serial.begin(9600);
}
void lpString(char* string) {
/****************************
http://www.beyondlogic.org/spp/parallel.htm
Data is first applied on the Parallel Port pins 2 to 7.
The host then checks to see if the printer is busy.
i.e. the busy line should be low. The program then
asserts the strobe, waits a minimum of 1uS, and then
de-asserts the strobe. Data is normally read by the
printer/peripheral on the rising edge of the strobe.
he printer will indicate that it is busy processing data
via the Busy line. Once the printer has accepted data,
t will acknowledge the byte by a negative pulse about
uS on the nAck line.
****************************/
int i = 0;
while(char c = string[i++]) {
// Spin on busy printer
while (digitalRead(PIN_BUSY) == HIGH){;}
// assert character to data lines
for (uint8_t b=0; b<8; b++) {
digitalWrite(4+b, c & 1);
c = c >> 1;
}
delayMicroseconds(50); // settle
// assert strobe,
// then deassert strobe (commit data)
digitalWrite(PIN_nSTROBE, LOW);
delayMicroseconds(50); // settle
digitalWrite(PIN_nSTROBE, HIGH);
// ignore BUSY, wait for falling nACK
while (digitalRead(PIN_nACK) == HIGH){;}
// now wait for rising nACK
while (digitalRead(PIN_nACK) == LOW){;}
}
}
void lpPorn(PGM_P string) {
int i = 0, j = 0;
char buf[80];
while (buf[j++] = pgm_read_byte(&string[i++])) {
// print a line a few times
if (buf[j-1] == '\n') {
buf[j-1] = 0; // terminate string
for (int k=1; k<=5; k++) {
lpString(buf);
Serial.println(buf);
}
//
lpString("\n");
j = 0; // reset
}
}
}
void loop() {
lpPorn(porn);
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,293 @@
#include <avr/interrupt.h>
#include <avr/io.h>
#include <LCD4Bit.h>
#include <assert.h>
#define DEBUG 0
#include "WProgram.h"
void awesome_scroller();
void setup_game();
void setup();
void display_paddle (int paddle, int pos);
void move_ball ();
void display_ball ();
void game_over();
void display_level();
void level_up();
void loop();
LCD4Bit lcd = LCD4Bit(2);
int pinA = 11;
int pinB = 12;
int ledPin = 13;
volatile int8_t enc_value = 0;
volatile int8_t enc_value_old = 0;
void awesome_scroller() {
// the logo
lcd.cursorTo(1,13);
lcd.printIn("ARDUINO POING");
lcd.cursorTo(2,1);
lcd.printIn("shall i prewarm sir's rotary encoder?");
// awesum fx
delay(500);
lcd.cursorTo(2,39);
for (int i=0; i<80; i++) {
lcd.print(' ');
delay(100);
}
}
#define SCALE 64
#define COLS 20
#define PADDLE2_POS (COLS-1)
int ball_x, ball_y;
int ball_vel_x, ball_vel_y;
uint8_t level;
void setup_game() {
lcd.clear();
// reinit stuff
ball_x = 2*SCALE;
ball_y = random(0,16);
ball_vel_x = 1.0 * SCALE;
ball_vel_y = 1.0 * SCALE;
//
for (int i=PADDLE2_POS+2; i<=39; i++) {
lcd.cursorTo(2, i);
lcd.print(' ');
}
// level
level = 1;
display_level();
// init paddles
enc_value = 0;
display_paddle(0,2);
display_paddle(1,2);
}
void setup() {
//Timer2 Settings
TCCR2A = 0;
TCCR2B = 0<<CS22 | 1<<CS21 | 0<<CS20;
//Timer2 Overflow Interrupt Enable
TIMSK2 = 1<<TOIE2;
// pullups
digitalWrite(pinA, HIGH);
digitalWrite(pinB, HIGH);
// init lcd
lcd.init();
lcd.clear();
// init serial
Serial.begin(9600);
// intro
// awesome_scroller();
//
setup_game();
}
#define ENC_STEPS 2
static int last;
ISR(TIMER2_OVF_vect) {
int neu, diff;
// convert gray to binary
neu = 0;
if(digitalRead(pinA))
neu = 3;
if(digitalRead(pinB))
neu ^= 1;
diff = last - neu; // difference last - new
if( diff & 1 ) { // bit 0 = value (1)
last = neu; // store new as next last
enc_value += (diff & 2) - 1; // bit 1 = direction (+/-)
}
// begrenze enc_value
if (enc_value < 1*ENC_STEPS)
enc_value = 1*ENC_STEPS;
if (enc_value > 14*ENC_STEPS)
enc_value = 14*ENC_STEPS;
}
void display_paddle (int paddle, int pos) {
#define CHAR_PADDLE paddle
assert(paddle == 0 || paddle == 1);
// blank first
lcd.cursorTo(1,paddle*(COLS-1)); lcd.print(' ');
lcd.cursorTo(2,paddle*(COLS-1)); lcd.print(' ');
// gen char
lcd.commandWrite(0x40+CHAR_PADDLE*8); // char 0b00
for (uint8_t i = 0; i<8; i++) {
if(i == (pos & 0x7) || i-1 == (pos & 0x7) || i+1 == (pos & 0x7) ) {
if (paddle == 0) {
lcd.print(0b00011);
} else {
lcd.print(0b11000);
}
} else {
lcd.print(0b00000);
}
}
// display shit
if (pos < 8) {
lcd.cursorTo(1,paddle*PADDLE2_POS); lcd.print(CHAR_PADDLE);
lcd.cursorTo(2,paddle*PADDLE2_POS); lcd.print(' ');
} else {
lcd.cursorTo(1,paddle*PADDLE2_POS); lcd.print(' ');
lcd.cursorTo(2,paddle*PADDLE2_POS); lcd.print(CHAR_PADDLE);
}
}
#define BALL_X_MAX (COLS-2)
#define res_x BALL_X_MAX*5*SCALE
#define res_y 16*SCALE
void move_ball () {
ball_x += ball_vel_x;
ball_y += ball_vel_y;
if (ball_x >= res_x || ball_x < 0) {
ball_vel_x *= -1;
ball_x += ball_vel_x;
}
if (ball_y >= res_y || ball_y < 0) {
ball_vel_y *= -1;
ball_y += ball_vel_y;
}
}
int cursor_x_alt = 1;
int cursor_y_alt = 1;
void display_ball () {
#define CHAR_BALL 2
int cursor_x = (ball_x/SCALE)/5+1;
int cursor_y = (ball_y/SCALE)/8+1;
// first, delete old ball
if (cursor_x != cursor_x_alt || cursor_y != cursor_y_alt) {
lcd.cursorTo(cursor_y_alt, cursor_x_alt);
lcd.print(' ');
}
cursor_x_alt = cursor_x;
cursor_y_alt = cursor_y;
// second, generate character for new ball
lcd.commandWrite(0x40+CHAR_BALL*8);
for (int i = 0; i<8; i++) {
if(i == ((ball_y/SCALE)&7)) {
lcd.print(1 << 4-(ball_x/SCALE)%5);
} else {
lcd.print(0b00000);
}
}
// third, write new ball
lcd.cursorTo(cursor_y, cursor_x);
lcd.print(CHAR_BALL);
}
void game_over() {
for (int8_t i=0; i<7; i++) {
lcd.cursorTo(2, PADDLE2_POS + 2);
lcd.printIn(" ");
delay(100);
lcd.cursorTo(2, PADDLE2_POS + 2);
lcd.printIn("GAME OVER.");
delay(200);
}
delay(1000);
while(enc_value == enc_value_old);
setup_game();
}
void display_level() {
lcd.cursorTo(1, PADDLE2_POS + 2);
lcd.printIn("LEVEL ");
char level_str[4];
itoa(level, level_str, 10);
lcd.printIn(level_str);
}
void level_up() {
// pump it up
level++;
display_level();
// make ball faster
// 70 / 64 is about 1.1
ball_vel_x = ball_vel_x * 70 / 64;
}
int player2 = random(1,14);
void loop() {
// move player1's paddle
int val = enc_value;
enc_value_old = val;
display_paddle(0, val/ENC_STEPS);
// teh ball!
move_ball();
display_ball();
// incoming ball? WIN or FAIL.
if (ball_x/SCALE < 1 && ball_vel_x < 0) {
if (val/ENC_STEPS-1 != ball_y/SCALE
&& val/ENC_STEPS != ball_y/SCALE
&& val/ENC_STEPS+1 != ball_y/SCALE) {
game_over();
} else {
level_up();
}
}
// fake computer player2 by moving its paddle in
// direction of the ball's vertical position
if (ball_vel_x > 0 && ball_x/SCALE > (BALL_X_MAX-4)*5) {
if (player2 < ball_y/SCALE && player2 < 14)
player2++;
if (player2 > ball_y/SCALE && player2 > 1)
player2--;
}
display_paddle(1, player2);
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

View file

@ -0,0 +1 @@
:00000001FF

Binary file not shown.

View file

@ -0,0 +1,346 @@
:100000000C9463000C948B000C948B000C948B006C
:100010000C948B000C948B000C948B000C948B0034
:100020000C948B000C9425040C948B000C948B0086
:100030000C948B000C948B000C948B000C948B0014
:100040000C947C060C948B000C9435070C948B005C
:100050000C948B000C948B000C948B000C948B00F4
:100060000C948B000C948B000000000024002700EF
:100070002A0000000000250028002B0000000000DE
:1000800023002600290004040404040404040202DA
:100090000202020203030303030301020408102007
:1000A0004080010204081020010204081020000012
:1000B0000007000201000003040600000000000029
:1000C00000007502770811241FBECFEFD4E0DEBF19
:1000D000CDBF11E0A0E0B1E0E0E1F5E102C00590A4
:1000E0000D92A837B107D9F712E0A8E7B1E001C037
:1000F0001D92AA32B107E1F710E0C6ECD0E004C0CF
:100100002297FE010E94B409C23CD107C9F70E94A0
:10011000BD050C94860A0C940000709364016093F2
:100120006301615070406230710530F081E090E011
:10013000909364018093630108958091590160E078
:100140000E94E30581E090E00E94EE068091590153
:1001500061E00E94E30581E090E00E94EE0680915C
:10016000590160E00E94E30561E070E080E090E00A
:100170000E94C4060895EF92FF920F931F93CF93AE
:10018000DF93EC018B010F701070E0905B01F09039
:100190005C010AC0602F61708E2D0E94E3051595E9
:1001A00007950894E11CF11C809161019091620116
:1001B0008E159F057CF7CE010E949D00DF91CF91A7
:1001C0001F910F91FF90EF9008950F931F93CF937E
:1001D000DF93EC018B0194E0759567959A95E1F7B3
:1001E000CE010E94BB00B8016F707070CE010E94FA
:1001F000BB00DF91CF911F910F9108950F931F9333
:10020000CF93DF938C01EB018091550160E00E9458
:10021000E3058091780190917901009729F0809110
:10022000570160E00E94E305C801BE010E94BB00C7
:10023000DF91CF911F910F9108950F931F93CF934B
:10024000DF938C01EB018091550161E00E94E30591
:100250008091780190917901009729F08091570160
:1002600060E00E94E305C801BE010E94E500DF9145
:10027000CF911F910F910895CF92DF92EF92FF924D
:100280001F93CF93DF937C01EB0110E00BC08C0F29
:100290009D1FFC016081772767FD7095C7010E9453
:1002A0001D011F5F812F90E06E01AC2FBD2DFD0160
:1002B00001900020E9F73197EA1BFB0B8E179F078F
:1002C00030F3DF91CF911F91FF90EF90DF90CF90AF
:1002D00008950F931F93CF93DF938C01EB018091CF
:1002E000550160E00E94E3058091780190917901C9
:1002F000009729F08091570160E00E94E305C80152
:10030000BE010E94E500DF91CF911F910F910895EA
:100310009B0160916301709164016130710529F066
:100320002230310511F4405C5F4FBA0160587F4FB5
:100330000E9469010895CF93DF93EC0180915901E8
:1003400061E00E94C4058091550161E00E94C405EE
:100350008091780190917901009729F0809157015F
:1003600061E00E94C40580915B0161E00E94C405C8
:1003700080915D0161E00E94C40580915F0161E0B0
:100380000E94C4058091610161E00E94C40562E39E
:1003900070E080E090E00E94C406CE0163E070E06F
:1003A0000E94FE0065E070E080E090E00E94C406DC
:1003B000CE0163E070E00E94FE0084E690E00E94BF
:1003C000EE06CE0163E070E00E94FE0065E070E0A2
:1003D00080E090E00E94C406CE0162E070E00E94DE
:1003E000FE00CE0162E070E00E94FE0060916301B9
:1003F000709164016150704023E0660F771F2A9569
:10040000E1F7CE010E94FE008CE390E00E94EE0630
:10041000CE016CE070E00E9469018CE390E00E94E4
:10042000EE06CE0161E070E00E94690163E070E0D9
:1004300080E090E00E94C406CE0166E070E00E9479
:10044000690161E070E080E090E00E94C406DF9105
:10045000CF91089561E070E00E94690161E070E071
:1004600080E090E00E94C40608956091810170913F
:10047000820120917D0130917E01260F371F30933C
:100480007E0120937D0140918301509184018091F0
:100490007F0190918001840F951F9093800180933C
:1004A0007F01E6E120383E0768F0709561957F4F47
:1004B0007093820160938101260F371F30937E0174
:1004C00020937D0124E08030920770F022273327AB
:1004D000241B350B3093840120938301820F931FDB
:1004E0009093800180937F0108958AE791E062E014
:1004F00070E00E948D0061E070E080E090E02EE00E
:1005000030E040E050E00E94D7087093870160938C
:1005100086010895EF92FF920F931F93DF93CF937D
:1005200000D000D0CDB7DEB70AE711E0C80161E026
:1005300070E045E150E00E948801C80160E071E090
:100540000E943C018091850190E07E010894E11CAD
:10055000F11CB7014AE050E00E941E0AC801B70131
:100560000E943C010F900F900F900F90CF91DF9160
:100570001F910F91FF90EF900895809185018F5FFB
:10058000809385010E948A0220918101309182012D
:1005900086E490E0AC01249FC001259F900D349F1C
:1005A000900D112460E470E00E944E097093820166
:1005B000609381010895AF92BF92CF92DF92EF9244
:1005C000FF920F931F93CF93DF9380917D019091C2
:1005D0007E0160E471E00E944E09EB01219680915A
:1005E0007F019091800160E072E00E944E098B01D2
:1005F0000F5F1F4F4091690150916A01C417D507E1
:1006000039F480916B0190916C010817190771F012
:1006100060916B0170916C018AE791E00E94880102
:100620008AE791E060E270E00E941D01D0936A01C8
:10063000C093690110936C0100936B018AE791E00C
:1006400060E570E00E946901EE24FF2494E0A92E89
:10065000B12C81E0C82ED12C80917F019091800136
:1006600060E470E00E944E0967707070E616F7064D
:10067000D1F480917D0190917E0160E470E00E9450
:100680004E09CB0165E070E00E944E09B501681B80
:10069000790BC60102C0880F991F6A95E2F7BC0169
:1006A0008AE791E004C08AE791E060E070E00E9490
:1006B0001D010894E11CF11C98E0E916F10461F6B3
:1006C0008AE791E0B801AE010E9488018AE791E0D3
:1006D00062E070E00E941D01DF91CF911F910F91A8
:1006E000FF90EF90DF90CF90BF90AF900895AF92C2
:1006F000BF92CF92DF92EF92FF920F931F93CF930F
:10070000DF93EC017B018230910510F00E94190A01
:1007100003E110E0C801C89F8001C99F100DD89F58
:10072000100D11248AE791E061E070E0A8010E94B9
:1007300088018AE791E060E270E00E941D018AE78B
:1007400091E062E070E0A8010E9488018AE791E0F0
:1007500060E270E00E941D01BE01685F7F4F33E0E0
:10076000660F771F3A95E1F78AE791E00E946901E9
:10077000CC24DD2427E0A22EB12CAE20BF20CA1449
:10078000DB0451F0C60101978A159B0529F0C601CB
:1007900001968A159B0561F4209729F48AE791E078
:1007A00063E070E009C08AE791E068E170E004C0AE
:1007B0008AE791E060E070E00E941D010894C11C8E
:1007C000D11C98E0C916D104D1F688E0E816F104EE
:1007D000C4F48AE791E061E070E0A8010E9488011A
:1007E0008AE791E0BE010E941D018AE791E062E084
:1007F00070E0A8010E9488018AE791E060E270E061
:1008000017C08AE791E061E070E0A8010E948801CA
:100810008AE791E060E270E00E941D018AE791E0C2
:1008200062E070E0A8010E9488018AE791E0BE01C1
:100830000E941D01DF91CF911F910F91FF90EF90CA
:10084000DF90CF90BF90AF9008951F920F920FB698
:100850000F9211242F933F934F935F936F937F9346
:100860008F939F93AF93BF93CF93DF93EF93FF93B8
:10087000809165010E942F06009719F0C3E0D0E037
:1008800002C0C0E0D0E0809167010E942F0600976F
:1008900021F081E090E0C827D9272091880130918C
:1008A00089012C1B3D0B20FF0BC0D0938901C09305
:1008B000880180917B0181502270820F80937B019F
:1008C00080917B0182301CF482E080937B018091D7
:1008D0007B018D311CF08CE180937B01FF91EF91C6
:1008E000DF91CF91BF91AF919F918F917F916F9148
:1008F0005F914F913F912F910F900FBE0F901F90DE
:100900001895CF93DF938AE791E00E942A0280E84E
:1009100090E090937E0180937D0160E070E080E044
:1009200090E020E130E040E050E00E94D708709372
:10093000800160937F0180E490E090938201809336
:1009400081019093840180938301C5E1D0E08AE71F
:1009500091E062E070E0AE010E9488018AE791E0D8
:1009600060E270E00E941D012196C832D10579F73E
:1009700081E0809385010E948A0210927B0180E0D1
:1009800090E062E070E00E94770381E090E062E036
:1009900070E00E947703DF91CF9108951F9310E0DC
:1009A0008AE791E062E070E045E150E00E94880152
:1009B0008AE791E06BE371E00E943C0164E670E03D
:1009C00080E090E00E94C4068AE791E062E070E077
:1009D00045E150E00E9488018AE791E066E471E019
:1009E0000E943C0168EC70E080E090E00E94C40648
:1009F0001F5F1730A9F668EE73E080E090E00E9478
:100A0000C40690917B0180917C019817D1F30E94DC
:100A100081041F910895EF92FF92CF93DF9380910D
:100A20007B0180937C01992787FD909562E070E0BF
:100A30000E944E09E62EE7017E01F72EE70180E0D5
:100A400090E0B7010E9477030E9435020E94DB020A
:100A500080917D0190917E018034910504F5809113
:100A600081019091820197FF1AC080917F0190913E
:100A7000800160E470E00E944E09970121503040EF
:100A80002617370751F0E616F70639F02196C617F4
:100A9000D70719F00E94CE0402C00E94BD028091C7
:100AA000810190918201181619068CF580917D01C3
:100AB00090917E0121E1803C92074CF120918601CA
:100AC0003091870180917F019091800160E470E016
:100AD0000E944E09CB01261737074CF42E30310502
:100AE00034F42F5F3F4F309387012093860120918C
:100AF000860130918701821793074CF4223031052B
:100B000034F021503040309387012093860160916A
:100B100086017091870181E090E00E947703DF9168
:100B2000CF91FF90EF900895CF93DF931092B00094
:100B300082E08093B10081E0809370008091650134
:100B400061E00E94E3058091670161E00E94E30596
:100B5000CAE7D1E0CE010E949B01CE010E942A0289
:100B600087E192E040E855E260E070E00E947307A0
:100B70000E948104DF91CF9108950E94FB060E949C
:100B800094050E940B05FDCF282F30E0C901865641
:100B90009F4FFC019491F901EA57FF4FE491EE2336
:100BA00089F0F0E0EE0FFF1FE859FF4FA591B491D7
:100BB000662329F48C91909589238C9308958C91C8
:100BC000892B8C930895482F50E0CA0182559F4F7E
:100BD000FC0194919A0126563F4FF9012491FA01A4
:100BE000EA57FF4FE491EE23C9F1992331F1933095
:100BF00021F4909180009F7705C0943031F490915A
:100C000080009F7D9093800018C0913019F494B5B6
:100C10009F7704C0923021F494B59F7D94BD0DC0A0
:100C2000963021F49091B0009F7705C0973029F459
:100C30009091B0009F7D9093B000F0E0EE0FFF1F09
:100C4000EE58FF4FA591B491662329F48C9120951D
:100C500082238C9308958C91822B8C930895282F56
:100C600030E0C90182559F4FFC019491A90146567D
:100C70005F4FFA014491F901EA57FF4FE491EE23E7
:100C800019F420E030E036C0992331F1933021F49B
:100C9000909180009F7705C0943031F4909180004E
:100CA0009F7D9093800018C0913019F494B59F7780
:100CB00004C0923021F494B59F7D94BD0DC0963050
:100CC00021F49091B0009F7705C0973029F490915E
:100CD000B0009F7D9093B000F0E0EE0FFF1FE4584E
:100CE000FF4FA591B4918C9120E030E0842311F066
:100CF00021E030E0C90108951F920F920FB60F92C4
:100D000011242F933F938F939F93AF93BF93809121
:100D10008E0190918F01A0919001B091910130913D
:100D200092010196A11DB11D232F2D5F2D3720F0BB
:100D30002D570196A11DB11D2093920180938E0124
:100D400090938F01A0939001B093910180918A01BB
:100D500090918B01A0918C01B0918D010196A11D04
:100D6000B11D80938A0190938B01A0938C01B09365
:100D70008D01BF91AF919F918F913F912F910F90D6
:100D80000FBE0F901F901895EF92FF920F931F9335
:100D90007B018C018FB7F89420918E0130918F01E7
:100DA00040919001509191018FBF6FB7F89480915D
:100DB0008E0190918F01A0919001B09191016FBF30
:100DC000821B930BA40BB50BE816F9060A071B0749
:100DD00060F71F910F91FF90EF900895019751F0E8
:100DE000880F991F880F991F02972FB7F8940197C2
:100DF000F1F72FBF0895789484B5826084BD84B5DF
:100E0000816084BD85B5826085BD85B5816085BD05
:100E1000EEE6F0E0808181608083E1E8F0E08081AF
:100E200082608083808181608083E0E8F0E080815F
:100E300081608083E1EBF0E0808184608083E0EB7F
:100E4000F0E0808181608083EAE7F0E08081846067
:100E500080838081826080838081816080838081C3
:100E6000806880831092C10008951F920F920FB680
:100E70000F9211242F933F934F935F936F937F9320
:100E80008F939F93AF93BF93EF93FF934091C600CF
:100E90002091130230911402C901019660E870E0BC
:100EA0000E944E09BC0180911502909116026817AC
:100EB000790741F02D563E4FF9014083709314029B
:100EC00060931302FF91EF91BF91AF919F918F912A
:100ED0007F916F915F914F913F912F910F900FBE36
:100EE0000F901F9018958F929F92AF92BF92DF92B2
:100EF000EF92FF920F931F93CF93DF93EC017A0150
:100F00008B01413482E458078FE0680780E078075E
:100F10000CF07FC060E874E88EE190E0A8019701D2
:100F20000E948309CA01B90161507040804090401D
:100F300022E030E040E050E00E94830949015A017C
:100F4000A5019401209530954095509594E0220F8D
:100F5000331F441F551F9A95D1F760E074E284EF68
:100F600090E00E948309CA01B9012FEF30E040E010
:100F700050E00E942F09A80197010E948309C9012E
:100F800021503F4F121613061CF4D82EDA9403C0DA
:100F9000DD24D394D81A60E079E08DE390E0A801D5
:100FA00097010E948309CA01B901615070408040D5
:100FB000904022E030E040E050E00E94830920951C
:100FC00030954095509583E0220F331F441F551FE5
:100FD0008A95D1F760E074E284EF90E00E94830983
:100FE000CA01B9012FEF30E040E050E00E942F0924
:100FF000A80197010E948309C90121503F4F121691
:1010000013061CF4282F215002C021E0281B2D15A7
:1010100000F5E885F98581E090E00A8802C0880F34
:10102000991F0A94E2F7808360E079E08DE390E015
:10103000A80197010E948309CA01B901615070405B
:101040008040904022E030E040E050E00E94830980
:1010500004C0E885F98510829401EC81FD8130831C
:10106000EE81FF812083EA85FB85808121E030E0ED
:10107000A9010E8402C0440F551F0A94E2F7842B85
:101080008083EA85FB858081A9010F8402C0440F1B
:10109000551F0A94E2F7842B8083EA85FB858081C3
:1010A000088802C0220F331F0A94E2F7822B808344
:1010B000DF91CF911F910F91FF90EF90DF90BF9044
:1010C000AF909F908F900895FC01A085B1852189F4
:1010D0008C9190E0022E02C0959587950A94E2F7D4
:1010E00080FFF6CF0484F585E02D6083089581E7C5
:1010F00091E0909318028093170283E991E0909316
:101100001A028093190285EC90E090931C02809360
:101110001B0284EC90E090931E0280931D0280ECF1
:1011200090E09093200280931F0281EC90E09093D6
:1011300022028093210286EC90E090932402809317
:10114000230284E08093250283E08093260287E0D7
:101150008093270285E08093280281E08093290212
:101160000895EF92FF920F931F937B018C016115FD
:1011700071058105910529F420E030E040E050E060
:101180000FC00E940B0AA80197010E948309572FE4
:10119000482F392F862F952FA42FB32F9C01AD01F7
:1011A000B901CA011F910F91FF90EF900895EF923E
:1011B000FF920F931F937B018C01621773078407C3
:1011C000950764F4CA01B9016E197F09800B910B70
:1011D0000E94B108E60EF71E081F191FB701C801CB
:1011E0001F910F91FF90EF9008950F931F93CF934E
:1011F000DF93EC018B0109C00F5F1F4FE881F9817C
:101200000190F081E02DCE010995F80160816623FF
:1012100099F7DF91CF911F910F910895EF92FF926F
:101220000F931F93CF93DF93EC018B017A010DC0D5
:10123000F80161918F01E881F9810190F081E02D41
:10124000CE0109950894E108F108E114F10481F751
:10125000DF91CF911F910F91FF90EF900895629FC2
:10126000D001739FF001829FE00DF11D649FE00D9E
:10127000F11D929FF00D839FF00D749FF00D659FFF
:10128000F00D9927729FB00DE11DF91F639FB00DFE
:10129000E11DF91FBD01CF011124089597FB092E0F
:1012A00007260AD077FD04D049D006D000201AF4D2
:1012B000709561957F4F0895F6F7909581959F4FB2
:1012C0000895A1E21A2EAA1BBB1BFD010DC0AA1F87
:1012D000BB1FEE1FFF1FA217B307E407F50720F09F
:1012E000A21BB30BE40BF50B661F771F881F991F1A
:1012F0001A9469F760957095809590959B01AC0163
:10130000BD01CF01089597FB092E05260ED057FD8C
:1013100004D0D7DF0AD0001C38F4509540953095A2
:1013200021953F4F4F4F5F4F0895F6F79095809569
:10133000709561957F4F8F4F9F4F0895AA1BBB1BE0
:1013400051E107C0AA1FBB1FA617B70710F0A61BC5
:10135000B70B881F991F5A95A9F780959095BC01E6
:10136000CD010895EE0FFF1F0590F491E02D099433
:10137000A0E0B0E0EEEBF9E00C94570AEC01E88055
:10138000F9800A811B81E114F1040105110541F482
:1013900084E2E82E89EDF82E8BE5082F87E0182FE0
:1013A000C801B7012DE133EF41E050E00E9483090D
:1013B00027EA31E440E050E00E942F095B016C0114
:1013C000C801B7012DE133EF41E050E00E948309ED
:1013D000CA01B9012CEE34EF4FEF5FEF0E942F09E5
:1013E0009B01AC012A0D3B1D4C1D5D1D57FF04C028
:1013F0002150304040405048288339834A835B83E2
:101400005F77B901CA01CDB7DEB7EAE00C94730A81
:101410000E94B809089581E591E00E94B8090895F5
:101420006093510170935201809353019093540142
:10143000089581E090E0F8940C94860AFB019F01E6
:10144000E8944230C4F04532B4F44A3029F497FBB2
:101450001EF4909581959F4F642F77270E949E09D7
:10146000805D8A330CF0895D8193CB010097A1F7F1
:1014700016F45DE251931082C9010C943F0ADC011D
:10148000FC01672F71917723E1F7329704C07C91BB
:101490006D9370836291AE17BF07C8F308952F92C2
:1014A0003F924F925F926F927F928F929F92AF92F4
:1014B000BF92CF92DF92EF92FF920F931F93CF9341
:1014C000DF93CDB7DEB7CA1BDB0B0FB6F894DEBFD8
:1014D0000FBECDBF09942A88398848885F846E84FE
:1014E0007D848C849B84AA84B984C884DF80EE8048
:1014F000FD800C811B81AA81B981CE0FD11D0FB651
:10150000F894DEBF0FBECDBFED010895F894FFCF74
:101510004C4556454C200041524455494E4F2050B1
:101520004F494E47007368616C6C2069207072658A
:101530007761726D20736972277320726F746172A4
:101540007920656E636F6465723F00202020202043
:1015500020202020200047414D45204F5645522E47
:10156000000100000002007F0003000400050006E7
:1015700000070002000B000C000100010000000049
:08158000006408F5080E0900E3
:00000001FF

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,269 @@
#include <avr/interrupt.h>
#include <avr/io.h>
#include <LCD4Bit.h>
#include <assert.h>
#define DEBUG 0
LCD4Bit lcd = LCD4Bit(2);
int pinA = 11;
int pinB = 12;
int ledPin = 13;
volatile int8_t enc_value = 0;
volatile int8_t enc_value_old = 0;
void awesome_scroller() {
// the logo
lcd.cursorTo(1,13);
lcd.printIn("ARDUINO POING");
lcd.cursorTo(2,1);
lcd.printIn("shall i prewarm sir's rotary encoder?");
// awesum fx
delay(500);
lcd.cursorTo(2,39);
for (int i=0; i<80; i++) {
lcd.print(' ');
delay(100);
}
}
#define SCALE 64
#define COLS 20
#define PADDLE2_POS (COLS-1)
int ball_x, ball_y;
int ball_vel_x, ball_vel_y;
uint8_t level;
void setup_game() {
lcd.clear();
// reinit stuff
ball_x = 2*SCALE;
ball_y = random(0,16);
ball_vel_x = 1.0 * SCALE;
ball_vel_y = 1.0 * SCALE;
//
for (int i=PADDLE2_POS+2; i<=39; i++) {
lcd.cursorTo(2, i);
lcd.print(' ');
}
// level
level = 1;
display_level();
// init paddles
enc_value = 0;
display_paddle(0,2);
display_paddle(1,2);
}
void setup() {
//Timer2 Settings
TCCR2A = 0;
TCCR2B = 0<<CS22 | 1<<CS21 | 0<<CS20;
//Timer2 Overflow Interrupt Enable
TIMSK2 = 1<<TOIE2;
// pullups
digitalWrite(pinA, HIGH);
digitalWrite(pinB, HIGH);
// init lcd
lcd.init();
lcd.clear();
// init serial
Serial.begin(9600);
// intro
// awesome_scroller();
//
setup_game();
}
#define ENC_STEPS 2
static int last;
ISR(TIMER2_OVF_vect) {
int neu, diff;
// convert gray to binary
neu = 0;
if(digitalRead(pinA))
neu = 3;
if(digitalRead(pinB))
neu ^= 1;
diff = last - neu; // difference last - new
if( diff & 1 ) { // bit 0 = value (1)
last = neu; // store new as next last
enc_value += (diff & 2) - 1; // bit 1 = direction (+/-)
}
// begrenze enc_value
if (enc_value < 1*ENC_STEPS)
enc_value = 1*ENC_STEPS;
if (enc_value > 14*ENC_STEPS)
enc_value = 14*ENC_STEPS;
}
void display_paddle (int paddle, int pos) {
#define CHAR_PADDLE paddle
assert(paddle == 0 || paddle == 1);
// blank first
lcd.cursorTo(1,paddle*(COLS-1)); lcd.print(' ');
lcd.cursorTo(2,paddle*(COLS-1)); lcd.print(' ');
// gen char
lcd.commandWrite(0x40+CHAR_PADDLE*8); // char 0b00
for (uint8_t i = 0; i<8; i++) {
if(i == (pos & 0x7) || i-1 == (pos & 0x7) || i+1 == (pos & 0x7) ) {
if (paddle == 0) {
lcd.print(0b00011);
} else {
lcd.print(0b11000);
}
} else {
lcd.print(0b00000);
}
}
// display shit
if (pos < 8) {
lcd.cursorTo(1,paddle*PADDLE2_POS); lcd.print(CHAR_PADDLE);
lcd.cursorTo(2,paddle*PADDLE2_POS); lcd.print(' ');
} else {
lcd.cursorTo(1,paddle*PADDLE2_POS); lcd.print(' ');
lcd.cursorTo(2,paddle*PADDLE2_POS); lcd.print(CHAR_PADDLE);
}
}
#define BALL_X_MAX (COLS-2)
#define res_x BALL_X_MAX*5*SCALE
#define res_y 16*SCALE
void move_ball () {
ball_x += ball_vel_x;
ball_y += ball_vel_y;
if (ball_x >= res_x || ball_x < 0) {
ball_vel_x *= -1;
ball_x += ball_vel_x;
}
if (ball_y >= res_y || ball_y < 0) {
ball_vel_y *= -1;
ball_y += ball_vel_y;
}
}
int cursor_x_alt = 1;
int cursor_y_alt = 1;
void display_ball () {
#define CHAR_BALL 2
int cursor_x = (ball_x/SCALE)/5+1;
int cursor_y = (ball_y/SCALE)/8+1;
// first, delete old ball
if (cursor_x != cursor_x_alt || cursor_y != cursor_y_alt) {
lcd.cursorTo(cursor_y_alt, cursor_x_alt);
lcd.print(' ');
}
cursor_x_alt = cursor_x;
cursor_y_alt = cursor_y;
// second, generate character for new ball
lcd.commandWrite(0x40+CHAR_BALL*8);
for (int i = 0; i<8; i++) {
if(i == ((ball_y/SCALE)&7)) {
lcd.print(1 << 4-(ball_x/SCALE)%5);
} else {
lcd.print(0b00000);
}
}
// third, write new ball
lcd.cursorTo(cursor_y, cursor_x);
lcd.print(CHAR_BALL);
}
void game_over() {
for (int8_t i=0; i<7; i++) {
lcd.cursorTo(2, PADDLE2_POS + 2);
lcd.printIn(" ");
delay(100);
lcd.cursorTo(2, PADDLE2_POS + 2);
lcd.printIn("GAME OVER.");
delay(200);
}
delay(1000);
while(enc_value == enc_value_old);
setup_game();
}
void display_level() {
lcd.cursorTo(1, PADDLE2_POS + 2);
lcd.printIn("LEVEL ");
char level_str[4];
itoa(level, level_str, 10);
lcd.printIn(level_str);
}
void level_up() {
// pump it up
level++;
display_level();
// make ball faster
// 70 / 64 is about 1.1
ball_vel_x = ball_vel_x * 70 / 64;
}
int player2 = random(1,14);
void loop() {
// move player1's paddle
int val = enc_value;
enc_value_old = val;
display_paddle(0, val/ENC_STEPS);
// teh ball!
move_ball();
display_ball();
// incoming ball? WIN or FAIL.
if (ball_x/SCALE < 1 && ball_vel_x < 0) {
if (val/ENC_STEPS-1 != ball_y/SCALE
&& val/ENC_STEPS != ball_y/SCALE
&& val/ENC_STEPS+1 != ball_y/SCALE) {
game_over();
} else {
level_up();
}
}
// fake computer player2 by moving its paddle in
// direction of the ball's vertical position
if (ball_vel_x > 0 && ball_x/SCALE > (BALL_X_MAX-4)*5) {
if (player2 < ball_y/SCALE && player2 < 14)
player2++;
if (player2 > ball_y/SCALE && player2 > 1)
player2--;
}
display_paddle(1, player2);
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,4 @@
P1
# CREATOR: GIMP PNM Filter Version 1.1
5 8
1000101010101011111101110100011000101010

Binary file not shown.

View file

@ -0,0 +1,14 @@
#!/usr/bin/perl
use strict;
my @lines = <>;
# P1
# # CREATOR: GIMP PNM Filter Version 1.1
# 5 8
# 1000101010101011111101110100011000101010
$lines[0] eq "P1\n" or die "First line should read 'P1' for Plain PBM";
for (my $line=0; $line <= $#lines;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,65 @@
// digital pins 2-7 => kathoden 0-5
// analog pins 3-5 => kathoden 6-8
// analog pins 0-2 => anoden A0, B1, C2
#include "WProgram.h"
void setup();
void loop();
volatile int matrix[9];
void setup() {
// digital pins 2-7
DDRD |= 0b11111100;
// analog pins 0-2 + 3-5
DDRC |= 0b00111111;
matrix = {
// ebene 0
0b101,
0b000,
0b101,
// ebene 1
0b000,
0b010,
0b000,
// ebene 2
0b101,
0b000,
0b101,
};
}
void loop() {
for(int ebene=0; ebene<=2; ebene++) {
// *erst* kathoden auf 1 (leuchtet nicht)
PORTD |= 0b11111100;
PORTC |= 0b00111000;
// anoden auf 0
PORTC &= 0b11111000;
// unsere anode auf 1
PORTC |= _BV(ebene+0);
// kathoden 0-2 => digital-pins 2-4
PORTD &= ~(matrix[3*ebene + 0] << 2);
// kathoden 3-5 => digital-pins 5-7
PORTD &= ~(matrix[3*ebene + 1] << 5);
// kathoden 6-8 => analog-pins 3-5
PORTC &= ~(matrix[3*ebene + 2] << 3);
}
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

View file

@ -0,0 +1 @@
:00000001FF

View file

@ -0,0 +1,43 @@
:100000000C9434000C9451000C9451000C94510049
:100010000C9451000C9451000C9451000C9451001C
:100020000C9451000C9451000C9451000C9451000C
:100030000C9451000C9451000C9451000C945100FC
:100040000C94BA000C9451000C9451000C94510083
:100050000C9451000C9451000C9451000C945100DC
:100060000C9451000C94510011241FBECFEFD4E02A
:10007000DEBFCDBF11E0A0E0B1E0ECE7F2E002C0EE
:1000800005900D92A231B107D9F711E0A2E1B1E0DC
:1000900001C01D92AD32B107E1F70E94B3000C948C
:1000A0003C010C9400008AB18C6F8AB987B18F63D0
:1000B00087B9A2E1B1E0E0E0F1E082E101900D92C8
:1000C0008150E1F7089580E090E020E030E061E0C9
:1000D00070E04BB14C6F4BB948B1486348B948B177
:1000E000487F48B948B1FB01022E02C0EE0FFF1F46
:1000F0000A94E2F74E2B48B9ABB1FC01EE0FFF1F9B
:10010000EE5EFE4F40815181440F551F440F551F35
:1001100040954A234BB9ABB1FC01EE0FFF1FEC5EDB
:10012000FE4F40815181E5E0440F551FEA95E1F70C
:1001300040954A234BB9A8B1FC01EE0FFF1FEA5EC0
:10014000FE4F40815181E3E0440F551FEA95E1F7EE
:1001500040954A2348B92F5F3F4F0396233031051E
:1001600009F0B7CF08950E9402010E9453000E9437
:100170006300FDCF1F920F920FB60F9211242F93A1
:100180003F938F939F93AF93BF938091280190915A
:100190002901A0912A01B0912B0130912C010196E7
:1001A000A11DB11D232F2D5F2D3720F02D57019656
:1001B000A11DB11D20932C0180932801909329014A
:1001C000A0932A01B0932B018091240190912501E5
:1001D000A0912601B09127010196A11DB11D809328
:1001E000240190932501A0932601B0932701BF918C
:1001F000AF919F918F913F912F910F900FBE0F90D4
:100200001F901895789484B5826084BD84B5816010
:1002100084BD85B5826085BD85B5816085BDEEE60E
:10022000F0E0808181608083E1E8F0E0808182609D
:100230008083808181608083E0E8F0E0808181605C
:100240008083E1EBF0E0808184608083E0EBF0E08C
:10025000808181608083EAE7F0E080818460808330
:1002600080818260808380818160808380818068DA
:0C02700080831092C1000895F894FFCF25
:10027C000500000005000000020000000500000061
:02028C0005006B
:00000001FF

View file

@ -0,0 +1,49 @@
// digital pins 2-7 => kathoden 0-5
// analog pins 3-5 => kathoden 6-8
// analog pins 0-2 => anoden A0, B1, C2
volatile int matrix[9];
void setup() {
// digital pins 2-7
DDRD |= 0b11111100;
// analog pins 0-2 + 3-5
DDRC |= 0b00111111;
matrix = {
// ebene 0
0b101,
0b000,
0b101,
// ebene 1
0b000,
0b010,
0b000,
// ebene 2
0b101,
0b000,
0b101,
};
}
void loop() {
for(int ebene=0; ebene<=2; ebene++) {
// *erst* kathoden auf 1 (leuchtet nicht)
PORTD |= 0b11111100;
PORTC |= 0b00111000;
// anoden auf 0
PORTC &= 0b11111000;
// unsere anode auf 1
PORTC |= _BV(ebene+0);
// kathoden 0-2 => digital-pins 2-4
PORTD &= ~(matrix[3*ebene + 0] << 2);
// kathoden 3-5 => digital-pins 5-7
PORTD &= ~(matrix[3*ebene + 1] << 5);
// kathoden 6-8 => analog-pins 3-5
PORTC &= ~(matrix[3*ebene + 2] << 3);
}
}

Binary file not shown.

View file

@ -0,0 +1,42 @@
// digital pins 2-7 => kathoden 1-6
// analog pins 3-5 => kathoden 7-9
// analog pins 0-2 => anoden A, B, C
#include "WProgram.h"
void setup();
void loop();
void setup() {
// digital pins 2-7
DDRD |= 0b11111100;
// analog pins 0-2 + 3-5
DDRC |= 0b00111111;
// anoden an
PORTC |= 0b00000111;
}
void loop() {
// kathoden auf 1 (leuchtet nicht)
PORTD |= 0b11111100;
PORTC |= 0b00111000;
delay(1000);
// kathoden auf 0 (leuchtet)
PORTD &= 0b00000011;
PORTC &= 0b11000111;
delay(1000);
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

View file

@ -0,0 +1 @@
:00000001FF

View file

@ -0,0 +1,39 @@
:100000000C9434000C9451000C9451000C94510049
:100010000C9451000C9451000C9451000C9451001C
:100020000C9451000C9451000C9451000C9451000C
:100030000C9451000C9451000C9451000C945100FC
:100040000C947D000C9451000C9451000C945100C0
:100050000C9451000C9451000C9451000C945100DC
:100060000C9451000C94510011241FBECFEFD4E02A
:10007000DEBFCDBF11E0A0E0B1E0E6E5F2E002C0F6
:1000800005900D92A030B107D9F711E0A0E0B1E0E2
:1000900001C01D92A930B107E1F70E9476000C94CF
:1000A00029010C9400008AB18C6F8AB987B18F63E3
:1000B00087B988B1876088B908958BB18C6F8BB987
:1000C00088B1886388B968EE73E080E090E00E94B0
:1000D000C5008BB183708BB988B1877C88B968EE15
:1000E00073E080E090E00E94C50008950E94EF0058
:1000F0000E9453000E945D00FDCF1F920F920FB629
:100100000F9211242F933F938F939F93AF93BF939D
:100110008091040190910501A0910601B091070121
:10012000309108010196A11DB11D232F2D5F2D37A0
:1001300020F02D570196A11DB11D20930801809339
:10014000040190930501A0930601B09307018091EB
:10015000000190910101A0910201B091030101966B
:10016000A11DB11D8093000190930101A093020194
:10017000B0930301BF91AF919F918F913F912F91C8
:100180000F900FBE0F901F901895EF92FF920F9354
:100190001F937B018C018FB7F8942091040130915B
:1001A000050140910601509107018FBF6FB7F89488
:1001B0008091040190910501A0910601B091070181
:1001C0006FBF821B930BA40BB50BE816F9060A0749
:1001D0001B0760F71F910F91FF90EF90089578949F
:1001E00084B5826084BD84B5816084BD85B582603C
:1001F00085BD85B5816085BDEEE6F0E080818160DA
:100200008083E1E8F0E0808182608083808181608A
:100210008083E0E8F0E0808181608083E1EBF0E0C2
:10022000808184608083E0EBF0E080818160808366
:10023000EAE7F0E08081846080838081826080834F
:100240008081816080838081806880831092C1007A
:060250000895F894FFCFB1
:00000001FF

View file

@ -0,0 +1,26 @@
// digital pins 2-7 => kathoden 1-6
// analog pins 3-5 => kathoden 7-9
// analog pins 0-2 => anoden A, B, C
void setup() {
// digital pins 2-7
DDRD |= 0b11111100;
// analog pins 0-2 + 3-5
DDRC |= 0b00111111;
// anoden an
PORTC |= 0b00000111;
}
void loop() {
// kathoden auf 1 (leuchtet nicht)
PORTD |= 0b11111100;
PORTC |= 0b00111000;
delay(1000);
// kathoden auf 0 (leuchtet)
PORTD &= 0b00000011;
PORTC &= 0b11000111;
delay(1000);
}

Binary file not shown.

View file

@ -0,0 +1,52 @@
// digital pins 2-7 => kathoden 0-5
// analog pins 3-5 => kathoden 6-8
// analog pins 0-2 => anoden A0, B1, C2
#include "WProgram.h"
void setup();
void loop();
void setup() {
// digital pins 2-7
DDRD |= 0b11111100;
// analog pins 0-2 + 3-5
DDRC |= 0b00111111;
}
void loop() {
for(int ebene=0; ebene<=2; ebene++) {
// anoden auf 0
PORTC &= 0b11111000;
// unsere anode auf 1
PORTC |= _BV(ebene+0);
for (int kathode=0; kathode<=8; kathode++) {
// kathoden auf 1 (leuchtet nicht)
PORTD |= 0b11111100;
PORTC |= 0b00111000;
// unsere kathode auf 0 (leuchtet)
if (kathode <= 5) {
PORTD &= ~_BV(kathode+2);
}
if (kathode >= 6 && kathode <= 8) {
PORTC &= ~_BV(kathode-6+3);
}
delay(400);
}
}
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

View file

@ -0,0 +1 @@
:00000001FF

View file

@ -0,0 +1,46 @@
:100000000C9434000C9451000C9451000C94510049
:100010000C9451000C9451000C9451000C9451001C
:100020000C9451000C9451000C9451000C9451000C
:100030000C9451000C9451000C9451000C945100FC
:100040000C94B9000C9451000C9451000C94510084
:100050000C9451000C9451000C9451000C945100DC
:100060000C9451000C94510011241FBECFEFD4E02A
:10007000DEBFCDBF11E0A0E0B1E0EEECF2E002C0E7
:1000800005900D92A030B107D9F711E0A0E0B1E0E2
:1000900001C01D92A930B107E1F70E94AE000C9497
:1000A00065010C940000EF92FF920F931F93CF9382
:1000B000DF9300E010E081E0E82EF12C88B1887F2A
:1000C00088B988B19701002E02C0220F331F0A940D
:1000D000E2F7822B88B9C0E0D0E08BB18C6F8BB98E
:1000E00088B1886388B9C630D10574F49BB19E018C
:1000F0002E5F3F4FA70102C0440F551F2A95E2F71C
:10010000842F809589238BB9CE0106978330910582
:1001100070F498B19E0123503040A70102C0440FF3
:10012000551F2A95E2F7842F8095892388B960E9C5
:1001300071E080E090E00E9401012196C930D10574
:1001400061F60F5F1F4F0330110509F0B7CFDF9144
:10015000CF911F910F91FF90EF9008950E942B0176
:100160008AB18C6F8AB987B18F6387B90E945300B7
:10017000FDCF1F920F920FB60F9211242F933F9332
:100180008F939F93AF93BF9380910401909105014A
:10019000A0910601B0910701309108010196A11DBF
:1001A000B11D232F2D5F2D3720F02D570196A11D56
:1001B000B11D209308018093040190930501A09341
:1001C0000601B09307018091000190910101A09177
:1001D0000201B09103010196A11DB11D80930001A0
:1001E00090930101A0930201B0930301BF91AF91DD
:1001F0009F918F913F912F910F900FBE0F901F9065
:100200001895EF92FF920F931F937B018C018FB78C
:10021000F89420910401309105014091060150911C
:1002200007018FBF6FB7F894809104019091050189
:10023000A0910601B09107016FBF821B930BA40B25
:10024000B50BE816F9060A071B0760F71F910F9117
:10025000FF90EF900895789484B5826084BD84B552
:10026000816084BD85B5826085BD85B5816085BDB1
:10027000EEE6F0E0808181608083E1E8F0E080815B
:1002800082608083808181608083E0E8F0E080810B
:1002900081608083E1EBF0E0808184608083E0EB2B
:1002A000F0E0808181608083EAE7F0E08081846013
:1002B000808380818260808380818160808380816F
:0E02C000806880831092C1000895F894FFCFEB
:00000001FF

View file

@ -0,0 +1,36 @@
// digital pins 2-7 => kathoden 0-5
// analog pins 3-5 => kathoden 6-8
// analog pins 0-2 => anoden A0, B1, C2
void setup() {
// digital pins 2-7
DDRD |= 0b11111100;
// analog pins 0-2 + 3-5
DDRC |= 0b00111111;
}
void loop() {
for(int ebene=0; ebene<=2; ebene++) {
// anoden auf 0
PORTC &= 0b11111000;
// unsere anode auf 1
PORTC |= _BV(ebene+0);
for (int kathode=0; kathode<=8; kathode++) {
// kathoden auf 1 (leuchtet nicht)
PORTD |= 0b11111100;
PORTC |= 0b00111000;
// unsere kathode auf 0 (leuchtet)
if (kathode <= 5) {
PORTD &= ~_BV(kathode+2);
}
if (kathode >= 6 && kathode <= 8) {
PORTC &= ~_BV(kathode-6+3);
}
delay(400);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,39 @@
#include "WProgram.h"
void setup();
void loop();
void setup() {
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
pinMode(4, OUTPUT);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
}
int count = 0;
void loop()
{
digitalWrite(7, (count & 0b100000) >> 5);
digitalWrite(6, (count & 0b010000) >> 4);
digitalWrite(5, (count & 0b001000) >> 3);
digitalWrite(4, (count & 0b000100) >> 2);
digitalWrite(3, (count & 0b000010) >> 1);
digitalWrite(2, (count & 0b000001) >> 0);
delay(1000);
count++;
}
int main(void)
{
init();
setup();
for (;;)
loop();
return 0;
}

View file

@ -0,0 +1 @@
:00000001FF

Binary file not shown.

View file

@ -0,0 +1,68 @@
:100000000C9461000C947E000C947E000C947E0095
:100010000C947E000C947E000C947E000C947E0068
:100020000C947E000C947E000C947E000C947E0058
:100030000C947E000C947E000C947E000C947E0048
:100040000C9463010C947E000C947E000C947E0052
:100050000C947E000C947E000C947E000C947E0028
:100060000C947E000C947E00000000002400270009
:100070002A0000000000250028002B0000000000DE
:1000800023002600290004040404040404040202DA
:100090000202020203030303030301020408102007
:1000A0004080010204081020010204081020000012
:1000B0000007000201000003040600000000000029
:1000C000000011241FBECFEFD4E0DEBFCDBF11E092
:1000D000A0E0B1E0E2E2F4E002C005900D92A030B1
:1000E000B107D9F711E0A0E0B1E001C01D92AB303B
:1000F000B107E1F70E94F1000C940F020C9400008C
:1001000060910001709101016072707045E0759519
:1001100067954A95E1F787E00E9417016091000119
:10012000709101016071707034E0759567953A9532
:10013000E1F786E00E9417016091000170910101D2
:100140006870707023E0759567952A95E1F785E0F2
:100150000E9417016091000170910101647070703C
:10016000759567957595679584E00E941701609174
:10017000000170910101627070707595679583E060
:100180000E94170160910001617082E00E941701D6
:1001900068EE73E080E090E00E94AB018091000186
:1001A00090910101019690930101809300010895BF
:1001B00087E061E00E94F80086E061E00E94F800BC
:1001C00085E061E00E94F80084E061E00E94F800B0
:1001D00083E061E00E94F80082E061E00E94F800A4
:1001E00008950E94D5010E94D8000E948000FDCF92
:1001F000282F30E0C90186569F4FFC019491F901E8
:10020000EA57FF4FE491EE2389F0F0E0EE0FFF1F75
:10021000E859FF4FA591B491662329F48C919095EC
:1002200089238C9308958C91892B8C930895482F62
:1002300050E0CA0182559F4FFC0194919A012656C5
:100240003F4FF9012491FA01EA57FF4FE491EE2361
:10025000C9F1992331F1933021F4909180009F7777
:1002600005C0943031F4909180009F7D9093800080
:1002700018C0913019F494B59F7704C0923021F4DE
:1002800094B59F7D94BD0DC0963021F49091B0003F
:100290009F7705C0973029F49091B0009F7D90938F
:1002A000B000F0E0EE0FFF1FEE58FF4FA591B491A4
:1002B000662329F48C91209582238C9308958C9148
:1002C000822B8C9308951F920F920FB60F921124D8
:1002D0002F933F938F939F93AF93BF93809106018A
:1002E00090910701A0910801B091090130910A0194
:1002F0000196A11DB11D232F2D5F2D3720F02D5705
:100300000196A11DB11D20930A01809306019093CF
:100310000701A0930801B093090180910201909117
:100320000301A0910401B09105010196A11DB11D29
:100330008093020190930301A0930401B0930501FF
:10034000BF91AF919F918F913F912F910F900FBED1
:100350000F901F901895EF92FF920F931F937B01C0
:100360008C018FB7F89420910601309107014091DC
:100370000801509109018FBF6FB7F8948091060171
:1003800090910701A0910801B09109016FBF821BF4
:10039000930BA40BB50BE816F9060A071B0760F7C9
:1003A0001F910F91FF90EF900895789484B582602B
:1003B00084BD84B5816084BD85B5826085BD85B509
:1003C000816085BDEEE6F0E0808181608083E1E8B8
:1003D000F0E0808182608083808181608083E0E8BA
:1003E000F0E0808181608083E1EBF0E080818460D7
:1003F0008083E0EBF0E0808181608083EAE7F0E0D9
:10040000808184608083808182608083808181603C
:1004100080838081806880831092C1000895F89461
:02042000FFCF0C
:00000001FF

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more