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での液晶,AQM0802Aで表示(i2c)(STM32L010F4P6)

Last updated at Posted at 2021-02-06

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

注意
mbedのリビジョンは、125

x PA9,PA10は、いつも間違えるので各自確認のこと

いぞがしい人のために
https://os.mbed.com/users/caa45040/code/AQM0802A_010_test1/

参考
STM32L010のMbedでの温度,STTS751で温度表示(AQM0802A)(STM32L010F4P6)
https://qiita.com/caa45040/items/54b5d2a9425c38b0d908


#include "mbed.h"
 
#define ADDR     (0x7C) //  address
 
//I2C i2c(I2C_SDA, I2C_SCL);
I2C i2c(PA_10, PA_9);

//DigitalOut myled(LED1);
 
//Serial pc(SERIAL_TX, SERIAL_RX);
 
//volatile char TempCelsiusDisplay[] = "+abc.d C";

int main()
{
 
    char data_read[2];
  
    //init
    wait(0.2);

    data_read[0] = 0x0;

    data_read[1]=0x38;
    i2c.write(ADDR, data_read, 2);

    data_read[1]=0x39;
    i2c.write(ADDR, data_read, 2);

    data_read[1]=0x14;
    i2c.write(ADDR, data_read, 2);

    data_read[1]=0x70;
    i2c.write(ADDR, data_read, 2);

    data_read[1]=0x56;
    i2c.write(ADDR, data_read, 2);

    data_read[1]=0x6C;
    i2c.write(ADDR, data_read, 2);

    wait(0.2);

    data_read[1]=0x38;
    i2c.write(ADDR, data_read, 2);

    data_read[1]=0x0C;
    i2c.write(ADDR, data_read, 2);

    data_read[1]=0x01;
    i2c.write(ADDR, data_read, 2);

    wait(0.2);

    data_read[0]='@';
    data_read[1]='a';
    i2c.write(ADDR, data_read, 2);


    while (1) {

        // Display result
//        pc.printf("temp = %s\n", TempCelsiusDisplay);
//        myled = !myled;
        wait(2.0);

    }
 
}


i2c_8x2_010_5.jpg

i2c_8x2_010_1.jpg

i2c_8x2_010_2.jpg

i2c_8x2_010_3.jpg

i2c_8x2_010_4.jpg

i2c_stm32l010_pa9_pa10_1.jpg

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?