test
Dependencies: LCD_DISCO_F429ZI BSP_DISCO_F429ZI
Revision 5:2020016f78e1, committed 2019-11-04
- Comitter:
- vladyslavn
- Date:
- Mon Nov 04 12:49:54 2019 +0000
- Parent:
- 4:18e08b8afd16
- Commit message:
- Success command "OK" and a bug in command "AT+GMR". May be needed clear buffers???
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BSP_DISCO_F429ZI.lib Mon Nov 04 12:49:54 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/SomeRandomBloke/code/BSP_DISCO_F429ZI/#a6fd0931a9e9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LCD_DISCO_F429ZI.lib Mon Nov 04 12:49:54 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST/code/LCD_DISCO_F429ZI/#dc55a068bc1a
--- a/main.cpp Fri Jun 23 17:47:51 2017 -0500 +++ b/main.cpp Mon Nov 04 12:49:54 2019 +0000 @@ -1,25 +1,55 @@ -/* mbed Example Program - * Copyright (c) 2006-2014 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ #include "mbed.h" - -Serial pc(USBTX, USBRX); // tx, rx - -int main() { - pc.printf("Hello World!\n\r"); - while(1) { - pc.putc(pc.getc() + 1); // echo input back to terminal +#include "LCD_DISCO_F429ZI.h" + +DigitalOut led(LED1); +LCD_DISCO_F429ZI lcd; +Serial pc(PA_9, PA_10, 9600); +Serial esp(PD_5, PD_6, 115200); + +char str[128], temp[32]; + +int main() +{ + BSP_LCD_SetFont(&Font16); + lcd.SetBackColor(LCD_COLOR_WHITE); + lcd.SetTextColor(LCD_COLOR_BLACK); + lcd.Clear(LCD_COLOR_WHITE); + + //Отключаем эхо + esp.printf("ATE0\r\n"); + wait(0.1); + + //Отправляем команду "AT" + pc.printf("PC: AT\n"); + esp.printf("AT\r\n"); + + //Слушаем ответ + do{ + esp.scanf("%s", temp); + strcat(str, temp); + }while(strcmp(temp, "OK") && strcmp(temp, "ERROR")); + pc.printf("Esp: %s\n", str); + + //Отправляем команду "AT+GMR" + pc.printf("PC: AT+GMR\n"); + esp.printf("AT+GMR\r\n"); + + //Слушаем ответ + do{ + esp.scanf("%s", temp); + strcat(str, temp); + }while(strcmp(temp, "OK") && strcmp(temp, "ERROR")); + pc.printf("Esp: %s\n", str); + + + + while(1) + { + led = 1; + wait(1); + led = 0; + wait(1); } -} \ No newline at end of file +} + +//lcd.DisplayStringAt(0, LINE(1), (uint8_t *)str, LEFT_MODE); \ No newline at end of file