Untitled
unknown
plain_text
a year ago
1.5 kB
1
Indexable
Never
#include <mega8535.h> #include <delay.h> void setup() { PORTB = 0x00; DDRB = 0xff; PORTC = 0xf0; DDRC = 0xf0; } void loop() { unsigned char bil[10] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f}; int kanan; int kiri; int i; int j = 0; int start = 0; int nim = 31; for (kiri = 0; kiri < 10; kiri++) { if (j == nim) break; for (kanan = 0; kanan < 10; kanan++) { if (j == nim) break; j++; for (i = 0; i < 10; i++) { PORTC.6 = 0; PORTC.7 = 1; PORTB = bil[kanan]; delay_ms(10); PORTC.7 = 0; PORTC.6 = 1; PORTB = bil[kiri]; delay_ms(10); } } } for (kiri = nim / 10; kiri >= 0; kiri--) { if (start == 0) { kanan = nim % 10; } else { kanan = 9; } for (kanan = kanan; kanan >= 0; kanan--) { start = 1; for (i = 0; i < 10; i++) { PORTC.7 = 0; PORTC.6 = 1; PORTB = bil[kiri]; delay_ms(10); PORTC.6 = 0; PORTC.7 = 1; PORTB = bil[kanan]; delay_ms(10); } } } } void main(void) { setup(); while (1) { loop(); } }