Grove Wifi 1 + arduino AT COMMANDS

Hello



I have arduinio and Groove Shield with Grove Wifi UART 1 .



I need to send “AT” command in arduino ide program are as possible ?



How send command and recevied to a variable ?



Thanks :smiley:

Hi, Please try to use the softwareserial. I use the digital port 2/3 to connect the grove uart wifi module. Here is the code. I do not have the module on hand and i can’t test it physically. please try and let us know the result. thanks.



#include <Wire.h>

#include <SoftwareSerial.h>

SoftwareSerial WIFI(2, 3);



void WIFI_init(void) {

unsigned long old_time;



//test AT command

WIFI.write(“AT\r\n”);

while (!WIFI.available()) {}

while (WIFI.available()) {

delay(10);

Serial.write(WIFI.read());

}

delay(500);



//Lists available APs

WIFI.write(“AT+CWLAP\r\n”);

while (!WIFI.available()) {}

old_time = millis();

while ((millis() - old_time)<4000)

{

if (WIFI.available())

Serial.write(WIFI.read());

}



// Connect to AP, won��t save to Flash

//WIFI.write(“AT+CWJAP_CUR=“seeed”,“2018seeed”\r\n”);



//Connect to AP and save AP info to flash

WIFI.write(“AT+CWJAP_DEF=“seeed”,“2018seeed”\r\n”);

while (!WIFI.available()) {}

old_time = millis();

while ((millis() - old_time)<10000)

{

if (WIFI.available())

Serial.write(WIFI.read());

}

}





void setup() {

WIFI.begin(9600);

Serial.begin(9600);

delay(1000);

WIFI_init();

}





void loop()

{

//UART WIFI communication program

if (Serial.available()) { // If anything comes in Serial,

WIFI.write(Serial.read()); // read it and send it out Software Serial (pins 2 & 3)

}



if (WIFI.available()) { // If anything comes in Software Serial (pins 2 & 3)

Serial.write(WIFI.read()); // read it and send it out Serial

}

}



Seeed techsupport team

Bill

If you use Arduino Expansion Shield for Raspberry Pi which is based on Arduino Leonardo Digital Pins will not work. Thus in that case use UART port.