IOTON boards API using mbed SDK - http://ioton.cc/plataforma-ton
Dependents: ton-bot_teste ton-bot_seguidor_linha ton-bot_seguidor_parede
Fork of IOTON-API by
Diff: Ioton.h
- Revision:
- 2:b3c3bf0b9101
- Parent:
- 0:cbba28a205fa
- Child:
- 3:9c7195d31602
--- a/Ioton.h Tue Nov 08 00:17:12 2016 +0000 +++ b/Ioton.h Tue Dec 20 13:50:15 2016 +0000 @@ -19,8 +19,10 @@ #include "mbed.h" #include "BMX055.h" -#include "ESP8266.h" #include "USBSerial.h" +#include "ESP8266Interface.h" +#include "MQTTESP8266.h" +#include "MQTTClient.h" #define ON 1 #define OFF 0 @@ -46,10 +48,14 @@ #define SW_USER PC_13 #define IMU_SCL PB_10 /* I2C2 */ #define IMU_SDA PB_11 -#define BTTX PA_9 /* USART1 */ -#define BTRX PA_10 -#define WIFITX PA_2 /* USART2 */ -#define WIFIRX PA_3 +#define BT_TX PA_9 /* USART1 */ +#define BT_RX PA_10 +#define WIFI_TX PA_2 /* USART2 */ +#define WIFI_RX PA_3 +#define WIFI_PWD PB_12 +#define WIFI_MODE PB_13 +#define WIFI_RST PC_15 + #define PIN0 PC_6 #define PIN1 PC_7 @@ -96,12 +102,10 @@ } LEDType_t; -Serial bluetooth(PA_9, PA_10); +Serial bluetooth(BT_TX, BT_RX); USBSerial usb(0x1f00, 0x2012, 0x0001, false); -ESP8266 wifi(PA_2, PA_3); -DigitalOut PWD(PB_12); -DigitalOut Mode(PB_13); -DigitalOut Reset(PC_15); +MQTTESP8266 wifi(WIFI_TX, WIFI_RX, WIFI_RST, WIFI_MODE, WIFI_PWD, "defualtssid", "defaultpass"); +DigitalOut Reset(WIFI_RST); DigitalIn USER(SW_USER); PwmOut ledRED(LED_RED); @@ -121,10 +125,6 @@ bluetooth.baud(9600); - PWD.write(0); - Mode.write(1); - Reset.write(0); - if (this->USERisPressed()) { *((unsigned long *) 0x2001FFFC) = 0xB00710AD; @@ -146,12 +146,6 @@ imu.init(mAscale, ACCBW, mGscale, GODRBW, Mmode, MODR); } - void enableWifi(void) - { - PWD.write(1); - Reset.write(1); - } - int USERisPressed(void) { return USER;