2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

arduinoでwifi

Posted at

オークションで手に入れた、esp8266をarduino unoにつないで見ました。
##写真
MVC-008S.JPG
##回路図
espk.PNG
##ハイパーターミナル
esp.PNG
##サンプルコード

#include "ESP8266wifi.h"
#include <SoftwareSerial.h>

#define RST_pin 			7
SoftwareSerial swSerial(10, 11);
int ledPin = 13;
String returnData;
ESP8266wifi wifi(Serial, Serial, RST_pin, swSerial);
void setup()
{
	pinMode(ledPin, OUTPUT);
	swSerial.begin(115200);
	Serial.begin(115200);
	wifi.setTransportToTCP();
	wifi.endSendWithNewline(true);
	wifi.begin();
	wifi.connectToAP("free-spot", "");
}
void loop()
{
	boolean isConnected = wifi.connectToServer("210.169.132.188", "80");
	if (wifi.isConnectedToServer())
	{
		wifi.send(SERVER, "GET / HTTP/1.0\r\n\r\n");
		WifiMessage in = wifi.listenForIncomingMessage(1000);
		if (in.hasData)
		{
			returnData = in.message;
		}
		Serial.println("Return is: " + returnData);
	}
	delay(9000);
}

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?