voor Arne

Dependencies:   ESP8266Interface FXAS21002 FXOS8700 Hexi_OLED_SSD1351

Fork of Hexi_Magneto-v2_Example by Hexiwear

Files at this revision

API Documentation at this revision

Comitter:
blownelco
Date:
Fri Dec 02 15:06:06 2016 +0000
Parent:
0:3fcdc27ab845
Child:
2:3c1fe1657db9
Commit message:
before wifi input

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Oct 19 22:55:10 2016 +0000
+++ b/main.cpp	Fri Dec 02 15:06:06 2016 +0000
@@ -6,7 +6,13 @@
 
 // Pin connections
 DigitalOut led1(LED_GREEN); // RGB LED
+DigitalOut PWD(PTB2);
+DigitalOut G15(PTB11);
+
+
+
 Serial pc(USBTX, USBRX); // Serial interface
+Serial wifi(PTD3, PTD2);
 FXOS8700 mag(PTC11, PTC10);
 SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6, PTD15); // SSD1351 OLED Driver (MOSI,SCLK,POWER,CS,RST,DC)
 
@@ -20,7 +26,68 @@
 char text3[20]; // Text Buffer for dynamic value displayed
 
 int main() {
+    
+    PWD = 1;
+    G15 = 0;     
+    /*Wifi initialisation commands */
+    
+    
+    wifi.baud(9600);
+    //wifi.format(8,"None",1);
+    Thread::wait(1000);
+    
+    printf("cmd -> AT\n");
+    
+    while (!pc.readable())
+    {
+    }
+    
         
+    //wifi.printf("AT/n");
+    wifi.printf("AT%c%c",0x0d,0x0A);
+    
+Thread::wait(1000);
+    //char c;
+    //char buffer[128];
+    
+    printf("cmd -> AT+GMR\n");
+
+
+    wifi.printf("AT+GMR%c%c",0x0d,0x0A);
+      
+  Thread::wait(1000); 
+    
+    printf("cmd -> AT+ CIPSTATUS\n");
+    
+    wifi.printf("AT+CIPSTATUS%c%c",0x0d,0x0A);  
+  
+      
+    while(1) {
+        
+        //printf("send AT");
+        //wifi.printf("AT/0x0D/0x0A");
+        //wait(0.5); werkt niet
+        
+        if(pc.readable()) {
+            wifi.putc(pc.getc());
+            
+        }
+        if(wifi.readable()) {
+            pc.putc(wifi.getc());
+
+        }
+    }
+      
+     // c = wifi.getc();
+    
+      //wifi.gets(buffer, 4);   
+    
+      //pc.printf("I got '%c' and '%s'\n", c, buffer);    
+    
+    //
+    
+    
+    /* end wifi */       
     // Configure Accelerometer FXOS8700, Magnetometer FXOS8700
     mag.mag_config();