Comunicação entre o Nucleo e um módulo WiFi ESP8266.

Dependencies:   mbed

Committer:
thiagofrosty
Date:
Thu Sep 14 02:36:05 2017 +0000
Revision:
0:1780d1882c05
Comunica??o b?sica entre o N?cleo e o m?dulo ESP8266.;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thiagofrosty0:1780d1882c05 1#include "mbed.h"
thiagofrosty0:1780d1882c05 2
thiagofrosty0:1780d1882c05 3#define ESP8266_TX PD_5
thiagofrosty0:1780d1882c05 4#define ESP8266_RX PD_6
thiagofrosty0:1780d1882c05 5
thiagofrosty0:1780d1882c05 6Serial ESP8266(ESP8266_TX,ESP8266_RX,115200);
thiagofrosty0:1780d1882c05 7
thiagofrosty0:1780d1882c05 8DigitalOut myled(LED3);
thiagofrosty0:1780d1882c05 9
thiagofrosty0:1780d1882c05 10int main()
thiagofrosty0:1780d1882c05 11{
thiagofrosty0:1780d1882c05 12 ESP8266.printf("AT\r\n");
thiagofrosty0:1780d1882c05 13 wait(1);
thiagofrosty0:1780d1882c05 14
thiagofrosty0:1780d1882c05 15 ESP8266.printf("AT+SYSIOSETCFG=12,3,0\r\n");
thiagofrosty0:1780d1882c05 16 wait(1);
thiagofrosty0:1780d1882c05 17
thiagofrosty0:1780d1882c05 18 ESP8266.printf("GPIOAT+SYSGPIODIR=12,1\r\n");
thiagofrosty0:1780d1882c05 19 wait(1);
thiagofrosty0:1780d1882c05 20
thiagofrosty0:1780d1882c05 21 ESP8266.printf("AT+SYSGPIOWRITE=12,1\r\n");
thiagofrosty0:1780d1882c05 22 wait(1);
thiagofrosty0:1780d1882c05 23
thiagofrosty0:1780d1882c05 24 while(1)
thiagofrosty0:1780d1882c05 25 {
thiagofrosty0:1780d1882c05 26 ESP8266.printf("AT+SYSGPIOWRITE=12,0\r\n");
thiagofrosty0:1780d1882c05 27 wait(1);
thiagofrosty0:1780d1882c05 28
thiagofrosty0:1780d1882c05 29 ESP8266.printf("AT+SYSGPIOWRITE=12,1\r\n");
thiagofrosty0:1780d1882c05 30 wait(1);
thiagofrosty0:1780d1882c05 31
thiagofrosty0:1780d1882c05 32 myled = !myled;
thiagofrosty0:1780d1882c05 33 }
thiagofrosty0:1780d1882c05 34}
thiagofrosty0:1780d1882c05 35
thiagofrosty0:1780d1882c05 36/*
thiagofrosty0:1780d1882c05 37int main()
thiagofrosty0:1780d1882c05 38{
thiagofrosty0:1780d1882c05 39 while(1)
thiagofrosty0:1780d1882c05 40 {
thiagofrosty0:1780d1882c05 41 ESP8266.printf("AT\r\n");
thiagofrosty0:1780d1882c05 42 wait(1);
thiagofrosty0:1780d1882c05 43 }
thiagofrosty0:1780d1882c05 44}
thiagofrosty0:1780d1882c05 45*/