RN41 Bluetooth Module Library
Embed:
(wiki syntax)
Show/hide line numbers
RN41.h
00001 #include "mbed.h" 00002 #include <string> 00003 00004 #ifndef RN41_H 00005 #define RN41_H 00006 00007 class RN41 { 00008 00009 public: 00010 00011 RN41(PinName tx, PinName rx); 00012 00013 //Public Commands 00014 bool reset(); 00015 00016 //set commands 00017 bool setDeviceName(string name); 00018 bool setAuthenticationMode(int authMode); 00019 bool setMode(int mode); //done 00020 00021 //get commands 00022 string getBluetoothAddress(); 00023 bool getConnectionStatus(); 00024 string getFirmwareVersion(); 00025 00026 //action commands 00027 bool connectToAddress(string address); 00028 00029 //Message Mode 00030 bool sendMessage(string message, char terminationChar); 00031 string recieveMessage(char terminationChar); 00032 00033 private: 00034 //Vaiables 00035 Serial _RN41; 00036 int _baud; 00037 bool _commandMode; 00038 00039 //Private Commands 00040 bool enterCommandMode(); 00041 bool exitCommandMode(); 00042 00043 //Send Data 00044 void sendString(string msg); 00045 bool readable(); 00046 string getString(); 00047 string getString(char terminationChar); 00048 char getChar(); 00049 }; 00050 00051 #endif
Generated on Fri Jul 15 2022 13:51:48 by 1.7.2