![](/media/cache/group/mebd_thumbnail.jpg.50x50_q85.jpg)
L432がUARTを受信する予定だったけど動かない
Dependencies: mbed BufferedSerial
main.cpp
- Committer:
- falconsyunya
- Date:
- 2022-05-16
- Revision:
- 1:196422c79186
- Parent:
- 0:c31f3c17df9c
File content as of revision 1:196422c79186:
/* mbed Microcontroller Library * Copyright (c) 2019 ARM Limited * SPDX-License-Identifier: Apache-2.0 */ #include "mbed.h" #include "PeripheralPins.h" #include "mbed_toolchain.h" //#include "BufferedSerial.h" extern const PinMap PinMap_UART_RX[] = { {PA_3, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, // {PA_3, LPUART_1,STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART1)}, // No LPUART_1 TX {PA_10, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, {PA_15, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_USART2)}, // Connected to STDIO_UART_RX {PB_7, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, {NC, NC, 0} }; //BufferedSerial L432(PA_2,PA_3,9600); //BufferedSerial im920(PA_9,PA_10,38400); Serial L432(PA_2,PA_3,9600); //Serial im920(PA_9,PA_10,38400); DigitalOut led(LED1); //BufferedSerial pc(USBTX,USBRX); //char str[15]; //int i=0; int main(){ //f303.baud(9600); //pc.baud(9600); printf("start\r\n"); led=0; char temp; while(1){ if(L432.readable()) { //f303からのデータがある場合 printf("readable\r\n"); //led=!led; led=!led; temp = L432.getc();//一文字読み込む //im920.printf("TXDA %c\r\n",temp); wait(1); //str[i++] = temp; } } }