0
0

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 1 year has passed since last update.

wemosでalexaデバイス その4

Posted at

概要

wemos d1で、alexaデバイスを作ってみる。
練習問題、やってみた。

練習問題

udpで、ブロードキャストで、ポート49153番に、helloを送信せよ。

サンプルコード

#include <ESP8266WiFi.h>
#include <WiFiUDP.h>

const char * ssid = "****";
const char * pass = "****";
static WiFiUDP udp;
#define LOCAL_PORT 		0xC000
#define REMOTE_PORT 	0xC001
IPAddress broadcastIP(239, 255, 255, 250);

void setup() {
	Serial.begin(115200);
	Serial.println("start");
	WiFi.begin(ssid, pass);
	while (WiFi.status() != WL_CONNECTED)
	{
		delay(500);
	}
	udp.begin(LOCAL_PORT);
}
void loop() {
	udp.beginPacketMulticast(broadcastIP, LOCAL_PORT, WiFi.localIP());
	udp.write("hello");
	udp.endPacket();
	delay(3000);
	Serial.print(".");
}




以上。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?