test

Dependencies:   BSP_DISCO_F746NG

Committer:
darkseb
Date:
Wed Jun 24 14:00:20 2020 +0000
Revision:
0:452fd39aec61
Code_HCO5_projet_gestion_de_commande_en_ligne_V2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
darkseb 0:452fd39aec61 1 ##include "mbed.h"
darkseb 0:452fd39aec61 2 #include "stm32746g_discovery_lcd.h"
darkseb 0:452fd39aec61 3
darkseb 0:452fd39aec61 4 Serial pc(USBTX, USBRX);
darkseb 0:452fd39aec61 5 Serial bt(PC_6, PC_7);
darkseb 0:452fd39aec61 6
darkseb 0:452fd39aec61 7 int main(void)
darkseb 0:452fd39aec61 8 {
darkseb 0:452fd39aec61 9 char ch;
darkseb 0:452fd39aec61 10 pc.baud(38400);
darkseb 0:452fd39aec61 11 bt.baud(38400);
darkseb 0:452fd39aec61 12
darkseb 0:452fd39aec61 13 pc.printf("Test1\n\r");
darkseb 0:452fd39aec61 14
darkseb 0:452fd39aec61 15 /*//Reset complet du HC-05 : Slave mode, pin code :1234, device name: H-C-2010-06-01 ,Baud 38400bits/s.
darkseb 0:452fd39aec61 16 bt.printf("AT+ORGL\r\n");
darkseb 0:452fd39aec61 17 bt.printf("AT+RESET\r\n");*/
darkseb 0:452fd39aec61 18
darkseb 0:452fd39aec61 19 //Sert à trouver certaines informations
darkseb 0:452fd39aec61 20 /*bt.printf("AT+INIT\r\n");
darkseb 0:452fd39aec61 21 bt.printf("AT+CMODE=1\r\n");
darkseb 0:452fd39aec61 22 bt.printf("AT+ROLE=1\r\n");*/
darkseb 0:452fd39aec61 23 //bt.printf("AT+ROLE?\r\n");
darkseb 0:452fd39aec61 24 //bt.printf("AT+IAC?\r\n");
darkseb 0:452fd39aec61 25 //bt.printf("AT+INQM?\r\n");
darkseb 0:452fd39aec61 26 //bt.printf("AT+INQ\r\n");
darkseb 0:452fd39aec61 27 //bt.printf("AT+INQC\r\n");
darkseb 0:452fd39aec61 28
darkseb 0:452fd39aec61 29 //Teléphone
darkseb 0:452fd39aec61 30 /*bt.printf("AT+INIT\r\n");
darkseb 0:452fd39aec61 31 bt.printf("AT+CMODE=1\r\n");
darkseb 0:452fd39aec61 32 bt.printf("AT+ROLE=1\r\n");
darkseb 0:452fd39aec61 33 bt.printf("AT+PAIR=C462,EA,691DFF,9\r\n");
darkseb 0:452fd39aec61 34 bt.printf("AT+BIND=C462,EA,691DFF\r\n");
darkseb 0:452fd39aec61 35 bt.printf("AT+CMODE=1\r\n");
darkseb 0:452fd39aec61 36 bt.printf("AT+LINK=C462,EA,691DFF\r\n");*/
darkseb 0:452fd39aec61 37
darkseb 0:452fd39aec61 38 //Scanner
darkseb 0:452fd39aec61 39 bt.printf("AT+INIT\r\n");
darkseb 0:452fd39aec61 40 bt.printf("AT+CMODE=1\r\n");
darkseb 0:452fd39aec61 41 bt.printf("AT+ROLE=1\r\n");
darkseb 0:452fd39aec61 42 bt.printf("AT+PAIR=1C,97,143502,600\r\n");
darkseb 0:452fd39aec61 43 bt.printf("AT+BIND=1C,97,143502\r\n");
darkseb 0:452fd39aec61 44 bt.printf("AT+CMODE=1\r\n");
darkseb 0:452fd39aec61 45 bt.printf("AT+LINK=1C,97,143502\r\n");
darkseb 0:452fd39aec61 46
darkseb 0:452fd39aec61 47 while(1)
darkseb 0:452fd39aec61 48 {
darkseb 0:452fd39aec61 49 if(bt.readable())
darkseb 0:452fd39aec61 50 {
darkseb 0:452fd39aec61 51 ch=bt.getc();
darkseb 0:452fd39aec61 52 pc.printf("%c",ch);
darkseb 0:452fd39aec61 53 //bt.printf("%c",ch);
darkseb 0:452fd39aec61 54 }
darkseb 0:452fd39aec61 55
darkseb 0:452fd39aec61 56 /*else if(pc.readable())
darkseb 0:452fd39aec61 57 {
darkseb 0:452fd39aec61 58 ch=pc.getc();
darkseb 0:452fd39aec61 59 //bt.printf("%c",ch);
darkseb 0:452fd39aec61 60 //pc.printf("%c",ch);
darkseb 0:452fd39aec61 61 }*/
darkseb 0:452fd39aec61 62 }
darkseb 0:452fd39aec61 63 }