1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

8x8右回り90度、回転(電光表示板用)

Last updated at Posted at 2025-05-09

いろいろ、注意

  • UNOでの予定は、未定

プログラム

オンラインコンパイラ paiza



#include <iostream>
using namespace std;

#define b_put(aa) for(int ii=8;ii!=0;ii--){if(aa & 0x80){printf("#");}else{printf(" ");}aa=aa<<1;}
#define bit8_put(bb) for(int jj=0;jj<8;jj++){b_put(bb[jj]);printf("\n");}

//void font_data_out(unsigned char *font){
//    for(int i=0;i<8;i++){
//        printf("[%02x]\n",font[i]);
//    }//for 
//    printf("\n");
//}//font_data_out


void font270(unsigned char *fontO, unsigned char *fontI){

    for(int i=0;i<8;i++){
    	fontO[i] = 0;
    }//for i
    
    for(int i=0;i<8;i++){

        //処理
        //        12345678
        int m = 0b10000000;
        int a = fontI[i];

        fontO[7] = fontO[7] >> 1;
        fontO[6] = fontO[6] >> 1;
        fontO[5] = fontO[5] >> 1;
        fontO[4] = fontO[4] >> 1;

        fontO[3] = fontO[3] >> 1;
        fontO[2] = fontO[2] >> 1;
        fontO[1] = fontO[1] >> 1;
        fontO[0] = fontO[0] >> 1;

        fontO[0] = fontO[0]|(a & m); a = a << 1;  
        fontO[1] = fontO[1]|(a & m); a = a << 1;
        fontO[2] = fontO[2]|(a & m); a = a << 1;
        fontO[3] = fontO[3]|(a & m); a = a << 1;

        fontO[4] = fontO[4]|(a & m); a = a << 1;
        fontO[5] = fontO[5]|(a & m); a = a << 1;
        fontO[6] = fontO[6]|(a & m); a = a << 1;
        fontO[7] = fontO[7]|(a & m);

    }//for i

}//font270


int main(void){
    // Your code here!

    unsigned char fontI[] = {
        0b00100000,
        0b01111100,
        0b00100000,
        0b01111100,
        0b10101010,
        0b10110010,
        0b01100100,
        0b00000000
    };     
    
    
    //bit8_put(fontI);printf("\n");
    
    unsigned char font[8];
    
    font270(font,fontI);
    
    bit8_put(font);
    
}




  ##    
 #  # # 
 #######
  # # # 
   ## # 
 #  # # 
  ##    
        

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?