Difference between revisions of "Grove - UART WiFi V2"

From
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 10: Line 10:
  
 
[[File:Grove - UART Wifi V2.jpg | 400px]]
 
[[File:Grove - UART Wifi V2.jpg | 400px]]
 +
 +
=== Assemblage ===
 +
 +
Dans le wiki le code est écrit pour Seeeduino Lite, qui utilisé <font color=red>Serial1</font><br>
 +
pour les autres contrôleurs mentionnés ici il faut remplacer par <font color=red>Serial</font><br>
 +
 +
le code ici indiqué est compatible pour les 3 contrôleurs<br>
 +
 +
[[Seeeduino V4.2| Seeeduino V4.2]]<br>
 +
[[Seeeduino Nano| Seeeduino Nano]]<br>
 +
[[Seeeduino Cortex-M0+| Seeeduino Cortex-M0+]]<br>
 +
 +
Le code a besoin
 +
[[OLED Display 0.96| OLED Display 0.96 inches ]] connecté au <b>port I2C</b><br>
 +
<font color=red>Grove-UART Wifi</font> connecté au <b>port SERIAL</b>
  
 
=== Code ===
 
=== Code ===
Line 152: Line 167:
 
=== Liens ===
 
=== Liens ===
  
[https://www.seeedstudio.com/Grove-UART-WiFi-V2-ESP8285.html www.seeedstudio.com/Grove-UART-WiFi-V2-ESP8285.html] shop bazar
+
[https://www.seeedstudio.com/Grove-UART-WiFi-V2-ESP8285.html www.seeedstudio.com/Grove-UART-WiFi-V2-ESP8285.html] <b>shop bazar</b>
  
[https://github.com/Seeed-Studio/OLED_Display_128X64 github.com/Seeed-Studio/OLED_Display_128X64] github
+
[http://wiki.seeedstudio.com/Grove-UART_Wifi_V2/ wiki.seeedstudio.com/Grove-UART_Wifi_V2] <b>wiki</b>
  
[http://wiki.seeedstudio.com/Grove-UART_Wifi_V2/ wiki.seeedstudio.com/Grove-UART_Wifi_V2] wiki
+
=== Libraries ===
  
=== Libraries ===
+
[https://github.com/Seeed-Studio/OLED_Display_128X64 github.com/Seeed-Studio/OLED_Display_128X64] <b>github</b>

Latest revision as of 22:49, 9 October 2024

UART Wifi V2[edit]

WiFi Chip = ESP8285
Antenna Type = On-board

images[edit]

Grove - UART Wifi V2 front.jpg Grove - UART Wifi V2 back.jpg

Grove - UART Wifi V2.jpg

Assemblage[edit]

Dans le wiki le code est écrit pour Seeeduino Lite, qui utilisé Serial1
pour les autres contrôleurs mentionnés ici il faut remplacer par Serial

le code ici indiqué est compatible pour les 3 contrôleurs

Seeeduino V4.2
Seeeduino Nano
Seeeduino Cortex-M0+

Le code a besoin OLED Display 0.96 inches connecté au port I2C
Grove-UART Wifi connecté au port SERIAL

Code[edit]

// test grove - uart wifi
// scan ap and display on Grove - OLED 0.96'
// Loovee @ 2015-7-28

#include <Wire.h>
#include <SeeedOLED.h>

char ap_buf[30][16];
int ap_cnt = 0;

void setup()
{
    Serial.begin(115200);

    delay(3000);
    Wire.begin();
    SeeedOled.init();                   // initialze SEEED OLED display

    SeeedOled.clearDisplay();           // clear the screen and set start position to top left corner
    SeeedOled.setNormalDisplay();       // Set display to normal mode (i.e non-inverse mode)
    SeeedOled.setPageMode();            // Set addressing mode to Page Mode

}


void loop()
{
    ap_cnt = 0;
    SeeedOled.clearDisplay();
    SeeedOled.setTextXY(3,0);    
    SeeedOled.putString("Wifi Scan..."); 

    cmd_send("AT+CWLAP");
    wait_result();
    
    display_ap();
    delay(5000);
}

// send command
void cmd_send(char *cmd)
{
    if(NULL == cmd)return;
    Serial.println(cmd);
}


// wait result of ap scan
// +CWLAP:(3,"360WiFi-UZ",-81,"08:57:00:01:61:ec",1)
void wait_result()
{
    while(1)
    {
LOOP1:
        char c1=0;
        if(Serial.available()>=2)
        {
            c1 = Serial.read();
            if(c1 == 'O' && 'K' == Serial.read())return;       // OK means over
        }
        
        if('('==c1)
        {
            while(Serial.available()<3);
            Serial.read();
            Serial.read();
            Serial.read();

            int d = 0;
            while(1)
            {
                if(Serial.available() && '"' == Serial.read());      // find "
                {
                    while(1)
                    {
                        if(Serial.available())
                        {
                            char c = Serial.read();
                            ap_buf[ap_cnt][d++] = c;
                            if(c == '"' || d==16)
                            {
                                ap_buf[ap_cnt][d-1] = '\0';
                                ap_cnt++;
                                goto LOOP1;
                            }
                        }
                    }
                }
            }
        }
    }
}

// display
void display_ap()
{
    char strtmp[16];
    sprintf(strtmp, "get %d ap", ap_cnt);
    
    SeeedOled.clearDisplay();           // clear
    SeeedOled.setTextXY(3,3);           // Set the cursor to Xth Page, Yth Column
    SeeedOled.putString(strtmp);        // Print the String
 
    delay(2000);
    
    int cnt = ap_cnt;
    int offset = 0;
    while(1)
    {
        SeeedOled.clearDisplay(); 
        if(cnt>=8)
        {
            for(int i=0; i<8; i++)
            {
                SeeedOled.setTextXY(i,0);           // Set the cursor to Xth Page, Yth Column
                SeeedOled.putString(ap_buf[8*offset+i]);        // Print the String
            }
            cnt-=8;
            offset++;
        }
        else 
        {
            for(int i=0; i<cnt; i++)
            {
                SeeedOled.setTextXY(i,0);           // Set the cursor to Xth Page, Yth Column
                SeeedOled.putString(ap_buf[8*offset+i]);        // Print the String
            }
            
            return;
        }
        
        delay(2000);
    }
}

Liens[edit]

www.seeedstudio.com/Grove-UART-WiFi-V2-ESP8285.html shop bazar

wiki.seeedstudio.com/Grove-UART_Wifi_V2 wiki

Libraries[edit]

github.com/Seeed-Studio/OLED_Display_128X64 github