test

Dependencies:   BSP_DISCO_F746NG

main.cpp

Committer:
darkseb
Date:
2020-06-24
Revision:
0:452fd39aec61

File content as of revision 0:452fd39aec61:

##include "mbed.h"
#include "stm32746g_discovery_lcd.h"

Serial pc(USBTX, USBRX);
Serial bt(PC_6, PC_7);

int main(void)
{
    char ch;
    pc.baud(38400);
    bt.baud(38400);
    
    pc.printf("Test1\n\r");

    /*//Reset complet du HC-05 : Slave mode, pin code :1234, device name: H-C-2010-06-01 ,Baud 38400bits/s.
    bt.printf("AT+ORGL\r\n");
    bt.printf("AT+RESET\r\n");*/
    
    //Sert à trouver certaines informations 
    /*bt.printf("AT+INIT\r\n");
    bt.printf("AT+CMODE=1\r\n");
    bt.printf("AT+ROLE=1\r\n");*/
    //bt.printf("AT+ROLE?\r\n");   
    //bt.printf("AT+IAC?\r\n");
    //bt.printf("AT+INQM?\r\n");
    //bt.printf("AT+INQ\r\n");
    //bt.printf("AT+INQC\r\n");
    
    //Teléphone
    /*bt.printf("AT+INIT\r\n");
    bt.printf("AT+CMODE=1\r\n");
    bt.printf("AT+ROLE=1\r\n");
    bt.printf("AT+PAIR=C462,EA,691DFF,9\r\n");
    bt.printf("AT+BIND=C462,EA,691DFF\r\n");
    bt.printf("AT+CMODE=1\r\n");
    bt.printf("AT+LINK=C462,EA,691DFF\r\n");*/
    
    //Scanner
    bt.printf("AT+INIT\r\n");
    bt.printf("AT+CMODE=1\r\n");
    bt.printf("AT+ROLE=1\r\n");
    bt.printf("AT+PAIR=1C,97,143502,600\r\n");
    bt.printf("AT+BIND=1C,97,143502\r\n");
    bt.printf("AT+CMODE=1\r\n");
    bt.printf("AT+LINK=1C,97,143502\r\n");
    
    while(1)
    {
        if(bt.readable())
        {
            ch=bt.getc();
            pc.printf("%c",ch);
            //bt.printf("%c",ch);
        }
        
        /*else if(pc.readable())
        {
            ch=pc.getc();
            //bt.printf("%c",ch);
            //pc.printf("%c",ch); 
        }*/
    }
}