Last active
December 6, 2015 11:16
-
-
Save eashi/800bdfd866c3c64b0bbd to your computer and use it in GitHub Desktop.
Put XBee to Command Mode
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
try | |
{ | |
byte[] bytes; | |
using (var stream = new OutputStream()) | |
{ | |
stream.Write("+++"); | |
bytes = stream.ToArray(); | |
} | |
Thread.Sleep(1000); | |
xBeeAdapter.Port.Write(bytes); | |
Thread.Sleep(1000); | |
while (xBeeAdapter.Port.BytesToRead > 0) | |
{ | |
var bytesToRead = new byte[xBeeAdapter.Port.BytesToRead]; | |
xBeeAdapter.Port.Read(bytesToRead, 0, xBeeAdapter.Port.BytesToRead); | |
} | |
xBeeAdapter.Port.Close(); | |
} | |
catch (Exception ex) | |
{ | |
Debug.Print(ex.Message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment