0
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?

More than 3 years have passed since last update.

STM32L010のMbedでのHT16K33でナイトライダー(Keil)

Posted at

x Mbed2

1.SCLとSDAを接続、プルアップも忘れずに
2.電源の接続
3.下記のソースコードを書き込む
4.コンパイル実行で表示されたら終了
5.おわり

なぜかわからないがmbed.bldのファイルを変更したら動いた

mbed.bld


https://os.mbed.com/users/mbed_official/code/mbed/builds/2e9cc70d1897




//HT16K33_010_1_1

#include "mbed.h"

#define ADDR        (0xE0)  //  address

I2C i2c(PA_10, PA_9); //010

char data_read[8];  //i2cバッファー
int ii;             //ループカウンター


int main() {
    
//INIT start *********  
    
    data_read[0]=0x21;
    i2c.write(ADDR, data_read, 1);wait_ms(1);

    data_read[0]=0x81;
    i2c.write(ADDR, data_read, 1);wait_ms(1);

    data_read[0]=0xef;
    i2c.write(ADDR, data_read, 1);wait_ms(1);

    for(ii=0;ii<16;ii++){
        data_read[0]=ii;
        data_read[1]=0x00;
        i2c.write(ADDR, data_read, 2);wait_ms(1);
    }//for

    
    wait_ms(2000);
    
//INIT end *********    

    while(1){
        for(ii=0;ii<8;ii++){
        
        data_read[0]=0;
        data_read[1]= (1<<ii);
        i2c.write(ADDR, data_read, 2);wait_ms(1000);

        }//for
    }//while

} // main

void error(const char* format, ...){}




0
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
0
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?