Last active
August 29, 2015 14:02
-
-
Save coldcue/916b787cd1da78a8cd90 to your computer and use it in GitHub Desktop.
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
#include "Wifi.h" | |
// set up a new serial port | |
void setup() { | |
Wifi wifi; | |
Serial.begin(9600); | |
delay(5000); | |
wifi.init(); | |
} | |
void loop() { | |
if(Serial1.available() > 0){ | |
Serial.write(Serial1.read()); | |
} | |
} |
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
#include "Wifi.h" | |
#include "Arduino.h" | |
//Wifi beallitas | |
void Wifi::init() { | |
char buf[256]; | |
Serial1.begin(9600); | |
Serial1.setTimeout(250); | |
Serial.println("WIFI: Command mode ON"); | |
delay(300); | |
Serial1.write("$$$"); | |
delay(300); | |
Serial1.write("set ip dhcp 1\r"); | |
Serial1.write("set wlan phrase 71063690\r"); | |
Serial1.write("join Lumia720_7970\r"); | |
Serial1.write("exit\r"); | |
} | |
int Wifi::getResponse(char* buf, int b_len) { | |
int len; | |
len = Serial1.readBytesUntil('\r', buf, b_len); | |
//Serial.println(buf); | |
return len; | |
} |
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
#ifndef Wifi_h | |
#define Wifi_h | |
class Wifi { | |
public: | |
void init(); | |
private: | |
int getResponse(char* buf, int b_len); | |
}; | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment