Created
March 4, 2019 18:01
-
-
Save sbis04/5065cc27bfb965a7df516e8207c8ea7c to your computer and use it in GitHub Desktop.
Sending message to Bluetooth Module
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
... | |
// Method to send message, | |
// for turning the bletooth device on | |
void _sendOnMessageToBluetooth() { | |
bluetooth.isConnected.then((isConnected) { | |
if (isConnected) { | |
bluetooth.write("1"); | |
show('Device Turned On'); | |
} | |
}); | |
} | |
// Method to send message, | |
// for turning the bletooth device off | |
void _sendOffMessageToBluetooth() { | |
bluetooth.isConnected.then((isConnected) { | |
if (isConnected) { | |
bluetooth.write("0"); | |
show('Device Turned Off'); | |
} | |
}); | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment