Arduino compatibility for HM10

#19
This commit is contained in:
1technophile committed 2017-05-06 23:07:24 +02:00
1 parent d63636bf31
commit c0879e8d22
3 files changed
+13 -7

No files matched your search

+4 -5
View File
@@ -107,7 +107,7 @@ RF supported protocols
#define pubIRunknownPrtcl false // key to avoid mqtt publication of unknown IR protocol (set to true if you want to publish unknown protocol)
#ifdef ESP8266 //IR supported protocols on ESP8266, all supported per default
#define IR_Raw
#define IR_GC
#define IR_COOLIX
#define IR_Whynter
#define IR_LG
@@ -117,7 +117,6 @@ RF supported protocols
#define IR_Sharp
#define IR_SAMSUNG
#else //IR supported protocols on arduino uncomment if you want to send with this protocol, NEC protocol is available per default
//#define IR_Raw
//#define IR_COOLIX
//#define IR_Whynter
//#define IR_LG
@@ -125,7 +124,7 @@ RF supported protocols
//#define IR_DISH
//#define IR_RC5
//#define IR_Sharp
#define IR_SAMSUNG
//#define IR_SAMSUNG
#endif
/*----------------------BT topics-------------------------*/
@@ -145,8 +144,8 @@ RF supported protocols
//IMPORTANT NOTE: On arduino UNO connect IR emitter pin to D9 , comment #define IR_USE_TIMER2 and uncomment #define IR_USE_TIMER1 on library <library>IRremote/IRremoteInt.h so as to free pin D3 for RF RECEIVER PIN
//RF PIN definition
#define RF_RECEIVER_PIN 1 // 1 = D3 on arduino
#define BT_RX 10
#define BT_TX 11
#define BT_RX 5
#define BT_TX 6
#endif
//RF number of signal repetition
#define RF_EMITTER_REPEAT 20
+9 -2
View File
@@ -19,6 +19,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Thanks to wolass https://github.com/wolass for suggesting me HM 10 and dinosd https://github.com/dinosd/BLE_PROXIMITY for inspiring me how to implement the gateway
*/
#ifdef ZgatewayBT
#include <SoftwareSerial.h>
@@ -26,6 +28,7 @@ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT
#define STRING_MSG "OK+DISC:"
#define QUESTION_MSG "AT+DISI?"
#define RESPONSE_MSG "OK+DISIS"
#define SETUP_MSG "OK+RESET"
#define TimeBtw_Read 10000
SoftwareSerial softserial(BT_RX, BT_TX);
@@ -56,9 +59,9 @@ boolean BTtoMQTT() {
for (int i=0;i<device_number;i++){
String onedevice = discResult.substring(0,78);
onedevice.replace(STRING_MSG,"");
String company = onedevice.substring(0,8);
/*String company = onedevice.substring(0,8);
String uuid = onedevice.substring(9,41);
String others = onedevice.substring(42,52);
String others = onedevice.substring(42,52);*/
String mac = onedevice.substring(53,65);
String rssi = onedevice.substring(66,70);
String mactopic = subjectBTtoMQTT + mac;
@@ -71,6 +74,10 @@ boolean BTtoMQTT() {
}
return true;
}
if (discResult.indexOf(SETUP_MSG)>=0)
{
trc(F("Connection OK to HM-10"));
}
}
if (millis() > (time1 + TimeBtw_Read)) {//retriving value of adresses and rssi
time1 = millis();
Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB