Increments the value by 1

Dependencies:   mbed-rtos mbed

Fork of test_thread_reneproj by GR_Peach_Abhinav_Rahul

main.cpp

Committer:
RahulSitaram
Date:
2017-01-09
Revision:
2:52ecf89221d3
Parent:
1:0ceb20b56f7f
Child:
3:e8db31793029

File content as of revision 2:52ecf89221d3:

#include "mbed.h"
#include "rtos.h"
#include <string>
 
DigitalOut led1(LED1);
DigitalOut led2(LED2);
std::string data;
char read_data;
uint8_t wifi_ack;
Serial pc(USBTX, USBRX);
//Serial Wifi(P2_14,P2_15);
Serial Wifi(P5_0, P5_1);
bool i = true;
bool j = false;
char MSB;
char LSB;
 
void reader_thread(void const *args) {
    while (true) {
        if(Wifi.readable()){
            while(Wifi.readable()){
                read_data = Wifi.getc();
                pc.putc(read_data);
            }
        }
    }
}
void send_to_device(string command){
    
 
    }
void setup_esp8266(){
    Wifi.baud(9600);
    pc.baud(9600);
    Wifi.puts("AT\r\n");
    wait(8);
    Wifi.puts("AT+RST\r\n");
    wait(8);
    Wifi.puts("AT+CWMODE=3\r\n");
    wait(8);
    Wifi.puts("AT+CWJAP=\"Googol\",\"sudopass\"\r\n");
    wait(8);
    Wifi.puts("AT+CIPMUX=1\r\n");
    wait(8);
    Wifi.printf("AT+CIPSTART=0,\"TCP\",\"reneproj.esy.es\"");
    wait(4);
    Wifi.printf(",80\r\n");
    wait(8);
    Wifi.puts("AT+CIPSEND=0,30\r\n");
    wait(8);
    Wifi.printf("GET reneproj.esy.es/peach/index.php?device_token=jabv5su2&device_id=gr_peach1&command4u=00 HTTP/1.1\r\n");
    wait(8);
    }
 
int main() {
    setup_esp8266();
    Thread thread(reader_thread);
    uint8_t data[3] = {0x47, 0x32, 0xA7};
    while (true) {
        wait(10);
    }
}