LOVE HURT coding

#define F_CPU 1000000UL
#include 
#include 
#include  
#include 
#include 

//Progmem simpannya di FLASH memory

const char love1[] PROGMEM =
{
0b0011110,
0b0100001,
0b1000010,
0b0100001,
0b0011110

};

const char love2[] PROGMEM =
{
0b0001100,
0b0010010,
0b0100100,
0b0010010,
0b0001100

};

const char L[] PROGMEM ={0x7f, 0x7f, 0x40, 0x40, 0x20}; 
const char O[] PROGMEM ={0x3e, 0x7f, 0x41, 0x41, 0x3e};
const char V[] PROGMEM ={0x3f, 0x7e, 0x40, 0x20, 0x1f};
const char E[] PROGMEM ={0x7f, 0x7f, 0x49, 0x49, 0x41};
const char H[] PROGMEM ={0x7f, 0x7f, 0x08, 0x08, 0x7f};
const char U[] PROGMEM ={0x3f, 0x7f, 0x40, 0x40, 0x3f};
const char R[] PROGMEM ={0x7f, 0x7f, 0x11, 0x29, 0x46};
const char T[] PROGMEM ={0x03, 0x03, 0x7f, 0x03, 0x02};

const char creature[]={0x4e, 0x31, 0x35, 0x31, 0x4e}; //simpan di memory/RAM aja

uint8_t EEMEM tengkorak[5]= {0x1e, 0x75, 0x61, 0x75, 0x1e}; //simpan di EEPROM

uint8_t EEMEM pacman[5]= {0x26, 0x67, 0x67, 0x7f, 0x3e}; //simpan di EEPROM


char dotnya[5],scrolnya[7];



void tulis(uint8_t lama)
{
  uint8_t a,b;

for(a=0 ; a> (step - 7) ;  
          
    tulis(10);
  } 
     step++; 
 
 }    

}




}


int main(void)
{
 DDRD = 0b1111111; // untuk baris
 DDRB = 0b11111;  // untuk kolom

 PORTD =0; // Set all pins low
 PORTB =0b11111; //matikan layar
    
    
 
 
 while(1)
 {
// yang ini nulis langsung 
  
     strncpy_P(dotnya,love2,5);
     tulis(20);
     strncpy_P(dotnya,love1,5);
     tulis(40);
 strncpy_P(dotnya,love2,5);
     tulis(20);
     strncpy_P(dotnya,love1,5);
     tulis(40);
     strncpy_P(dotnya,love2,5);
     tulis(20);
     strncpy_P(dotnya,love1,5);
     tulis(40);     

//yang ini pake function geser 

 strncpy_P(scrolnya,L,5);
     geser(50);
 strncpy_P(scrolnya,O,5);
     geser(50);
 strncpy_P(scrolnya,V,5);
     geser(50);
 strncpy_P(scrolnya,E,5);
     geser(50);
 strncpy_P(scrolnya,H,5);
     geser(50);
 strncpy_P(scrolnya,U,5);
     geser(50);
 strncpy_P(scrolnya,R,5);
     geser(50); 
 strncpy_P(scrolnya,T,5);
     geser(50); 

//geser ambil dari RAM
 
 strncpy(scrolnya,creature,5);  //tanpa _P karena ambil di RAM
     naik(50); 
 
//ambil dari eeprom ..mengirit..

     eeprom_read_block((void*)&scrolnya,(const void*)&tengkorak, 5); 
 naik(50);

     eeprom_read_block((void*)&scrolnya,(const void*)&pacman, 5); 
 geser(50);

 }
 
 return 0;
}

Komentar

Posting Komentar

Postingan populer dari blog ini

how to simply repeat order to PCBway