x 超超重要 なぜか秋月STM32G031J6M6がうり切れていた。注意!!(2022/8/27現在)
x 過去ログを見よ
x PA_2をOBでGPIOに出来る人むけ
x STM32G031は、秋月で売っているSTM32G031J6M6の事
目的
シリアルのテスト
mbed-osのシリアルをソースを見ていたら
PA_2,PA_3が有効なので作ってみた。
//ser_test_1_031_1
#include "mbed.h"
//シリアルの定義
UnbufferedSerial serial_port(PA_2, PA_3); //031
//メイン関数
int main()
{
//シリアルの初期化
serial_port.baud(9600);
serial_port.format(
/* bits */ 8,
/* parity */ SerialBase::None,
/* stop bit */ 1
);
char data_read[256]; //バッファー
//無限ループ
while(1) {
//文字列の表示
// 12345678901
serial_port.write("hello world\r\n", 11+2);
//数値の表示
sprintf( data_read, "%d\r\n", 1234 );
serial_port.write(data_read, 4+2);
//1秒待つ
wait_us(1000*1000);
} //while
} //main