sendMessageCLI method
Implementation
Future<void> sendMessageCLI() async {
try {
Uint8List message = Uint8List.fromList('#'.codeUnits);
port.write(message);
await Future.delayed(Duration(seconds: 1)); // simulate some delay
List<int> response = port.read(64);
if (response.isNotEmpty) {
print('Response Data: ${String.fromCharCodes(response)}');
} else {
print('No response received from the device.');
}
} finally {
port.close();
}
}