Created
August 28, 2016 11:42
-
-
Save windymelt/5eb5f21b20f6e3cf3a2754aedfaac8af to your computer and use it in GitHub Desktop.
Arduino FioとXBee S6B(Wi-Fi)で,XBeeを設定しTCP経由でテスト信号を送信するスケッチ
This file contains 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
void setup() { | |
// XBeeは標準で9600baudで通信を行う | |
Serial.begin(9600); | |
// 待つ | |
delay(1100); | |
// Configuration Modeに入る | |
Serial.print("+++"); | |
// 待つ | |
delay(1100); | |
// SSIDを設定 | |
Serial.print("atid ****************\r"); | |
delay(100); | |
// WPA2を指定 | |
Serial.print("atee 2\r"); | |
delay(100); | |
// パスフレーズを設定 | |
Serial.print("atpk ****************\r"); | |
delay(100); | |
// TCP通信を指定 | |
Serial.print("atip 1\r"); | |
delay(100); | |
// 設定をXBeeに記録したいときは次のコマンドを有効にする | |
// Serial.print("atwr\r"); | |
// delay(100); | |
// 設定を反映する | |
Serial.print("atac\r"); | |
delay(100); | |
// Configuration Modeから脱出する | |
Serial.print("atcn\r"); | |
// 標準では,9750番ポートで接続を待ち受ける | |
} | |
void loop() { | |
// テスト信号を1秒ごとに送信する | |
Serial.print("VVV\n"); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment