![](/media/cache/group/mebd_thumbnail.jpg.50x50_q85.jpg)
L432がUARTを受信する予定だったけど動かない
Dependencies: mbed BufferedSerial
main.cpp@0:c31f3c17df9c, 2022-05-03 (annotated)
- Committer:
- MatsumotoKouki
- Date:
- Tue May 03 06:32:58 2022 +0000
- Revision:
- 0:c31f3c17df9c
- Child:
- 1:196422c79186
L432 receive USART;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MatsumotoKouki | 0:c31f3c17df9c | 1 | /* mbed Microcontroller Library |
MatsumotoKouki | 0:c31f3c17df9c | 2 | * Copyright (c) 2019 ARM Limited |
MatsumotoKouki | 0:c31f3c17df9c | 3 | * SPDX-License-Identifier: Apache-2.0 |
MatsumotoKouki | 0:c31f3c17df9c | 4 | */ |
MatsumotoKouki | 0:c31f3c17df9c | 5 | |
MatsumotoKouki | 0:c31f3c17df9c | 6 | #include "mbed.h" |
MatsumotoKouki | 0:c31f3c17df9c | 7 | //#include "BufferedSerial.h" |
MatsumotoKouki | 0:c31f3c17df9c | 8 | |
MatsumotoKouki | 0:c31f3c17df9c | 9 | //BufferedSerial L432(PA_2,PA_3,9600); |
MatsumotoKouki | 0:c31f3c17df9c | 10 | //BufferedSerial im920(PA_9,PA_10,38400); |
MatsumotoKouki | 0:c31f3c17df9c | 11 | Serial L432(PA_2,PA_3,9600); |
MatsumotoKouki | 0:c31f3c17df9c | 12 | Serial im920(PA_9,PA_10,38400); |
MatsumotoKouki | 0:c31f3c17df9c | 13 | |
MatsumotoKouki | 0:c31f3c17df9c | 14 | DigitalOut led(LED1); |
MatsumotoKouki | 0:c31f3c17df9c | 15 | |
MatsumotoKouki | 0:c31f3c17df9c | 16 | //BufferedSerial pc(USBTX,USBRX); |
MatsumotoKouki | 0:c31f3c17df9c | 17 | //char str[15]; |
MatsumotoKouki | 0:c31f3c17df9c | 18 | //int i=0; |
MatsumotoKouki | 0:c31f3c17df9c | 19 | |
MatsumotoKouki | 0:c31f3c17df9c | 20 | int main(){ |
MatsumotoKouki | 0:c31f3c17df9c | 21 | //f303.baud(9600); |
MatsumotoKouki | 0:c31f3c17df9c | 22 | //pc.baud(9600); |
MatsumotoKouki | 0:c31f3c17df9c | 23 | //led=0; |
MatsumotoKouki | 0:c31f3c17df9c | 24 | char temp; |
MatsumotoKouki | 0:c31f3c17df9c | 25 | while(1){ |
MatsumotoKouki | 0:c31f3c17df9c | 26 | if(L432.readable()) { //f303からのデータがある場合 |
MatsumotoKouki | 0:c31f3c17df9c | 27 | printf("readable\r\n"); |
MatsumotoKouki | 0:c31f3c17df9c | 28 | led=!led; |
MatsumotoKouki | 0:c31f3c17df9c | 29 | temp = L432.getc();//一文字読み込む |
MatsumotoKouki | 0:c31f3c17df9c | 30 | im920.printf("TXDA %c\r\n",temp); |
MatsumotoKouki | 0:c31f3c17df9c | 31 | //str[i++] = temp; |
MatsumotoKouki | 0:c31f3c17df9c | 32 | } |
MatsumotoKouki | 0:c31f3c17df9c | 33 | } |
MatsumotoKouki | 0:c31f3c17df9c | 34 | } |