This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while( (sendATcommand("AT+CREG?", "+CREG: 0,1", 500) || | |
| sendATcommand("AT+CREG?", "+CREG: 0,5", 500)) == 0 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sendATcommand("AT+CGSOCKCONT=1,\"IP\",\"web.be\"","OK",1000); | |
| sendATcommand("AT+CSOCKAUTH=1,1,,\"web\",\"web\"","OK",1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout){ | |
| uint8_t x=0, answer=0; | |
| char response[100]; | |
| unsigned long previous; | |
| memset(response, '\0', 100); // Clean response buffer | |
| delay(100); // Delay to be sure no passed commands interfere | |
| while( Serial.available() > 0) Serial.read(); // Wait for clean input buffer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sendATcommand("AT", "OK", 2000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while(answer == 0){ // Send AT every two seconds and wait for the answer | |
| answer = sendATcommand("AT", "OK", 2000); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sendATcommand("AT+CPIN=1234", "OK", 2000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| answer = sendATcommand("AT+CGPS=1,2","OK",1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sendATcommand("AT+CGPSINFO","+CGPSINFO:",1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sendATcommand("AT+CHTTPACT=\"yourserver.com\",80", "+CHTTPACT: REQUEST", 60000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Serial.println("GET /a_random_subdirectory_or_file/index.php HTTP/1.1\r\nHost: www.yourserver.com\r\n\r\n"); |