Skip to content

Instantly share code, notes, and snippets.

@sbis04
Created March 4, 2019 18:01
Show Gist options
  • Save sbis04/5065cc27bfb965a7df516e8207c8ea7c to your computer and use it in GitHub Desktop.
Save sbis04/5065cc27bfb965a7df516e8207c8ea7c to your computer and use it in GitHub Desktop.
Sending message to Bluetooth Module
...
// 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