<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Using BLEPeripheral and MySensors libraries</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29102/using-bleperipheral-and-mysensors-libraries</link><description>I am using BLEPeripheral and MySensors libraries and nRF51822 device(client side).
I want to change functionality, if I press key of nRF51822 device it should start to advertise otherwise connect with another device (nodeMCU nad nRf24L01) act as a gateway</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Jan 2018 12:02:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29102/using-bleperipheral-and-mysensors-libraries" /><item><title>RE: Using BLEPeripheral and MySensors libraries</title><link>https://devzone.nordicsemi.com/thread/115499?ContentTypeID=1</link><pubDate>Thu, 11 Jan 2018 12:02:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6fe1a5d-3169-4c86-ba38-449fe811fe90</guid><dc:creator>denvincent</dc:creator><description>&lt;p&gt;MySensors library requires turning off the Bluetooth, when you use it. I&amp;#39;ve seen the similar questions on MySensor forum. Perhaps, there&amp;#39;s an issue with the configs of the Arduino platform, and perhaps to look in the Useful References section at &lt;a href="https://www.mysensors.org/apidocs-beta/group__aeslib.html"&gt;www.mysensors.org/.../group__aeslib.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using BLEPeripheral and MySensors libraries</title><link>https://devzone.nordicsemi.com/thread/115498?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 16:04:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d437a58d-44f2-4c72-a972-332076402739</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Yes, according to &lt;a href="https://www.openhardware.io/view/376/MySensors-NRF5-Platform"&gt;this website&lt;/a&gt; this seems to be true.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The Arduino port for nRF52 MCUs
provided for Arduino Primo Boards is
not compatible with MySensors at the
moment. The reason is the existence of
the SoftDevice handling BLE
connections. MySensors can be compiled
for the Primo board, but the NVM
driver is incompatible. When Arduino
Primo has an option to disable the
SoftDevice, then MySensors can be used
with the Arduino Primo variant. You
can use the Arduino Primo variants
with a custom board definition with
the MySensors board definition.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I&amp;#39;m not familiar with the MySensors library. But it seems that if you need to use this library, you will need to turn off the Bluetooth while you are using the library. For further help on this issue, you might have better luck asking in the MySensor forum and other forums for the Arduino platform.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using BLEPeripheral and MySensors libraries</title><link>https://devzone.nordicsemi.com/thread/115497?ContentTypeID=1</link><pubDate>Mon, 04 Dec 2017 09:27:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7842e97-53a3-44c5-abb7-3f29ea9a6602</guid><dc:creator>manisha</dc:creator><description>&lt;p&gt;Thanks Sir for your reply, the problem is our device is not able to advertise so how to connect central device.
I asked a question in My Sensor forum they told you cannot access ble feature and we cannot use both api together like BLEPeripheral.h and MySensor.h. Someone told DFU bootloader conflicts with the NVM library, which is used to store the MySensors configuration. MySensor library API is never tested with a device which is having softdevice.
please help me to resolve the memory issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using BLEPeripheral and MySensors libraries</title><link>https://devzone.nordicsemi.com/thread/115496?ContentTypeID=1</link><pubDate>Tue, 07 Nov 2017 21:30:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e0071d9-9e5a-47e8-84ca-a37269719282</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Could be that you need to restart the advertising after the central disconnect / you press the key ?&lt;/p&gt;
&lt;p&gt;Maybe you can call &lt;code&gt;blePeripheral.end();&lt;/code&gt; and then call &lt;code&gt;blePeripheral.begin();&lt;/code&gt; ?&lt;/p&gt;
&lt;p&gt;You can also use the function &lt;code&gt;blePeripheral.disconnect();&lt;/code&gt; to disconnect if you the press the button.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using BLEPeripheral and MySensors libraries</title><link>https://devzone.nordicsemi.com/thread/115495?ContentTypeID=1</link><pubDate>Tue, 24 Oct 2017 08:53:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f530e991-187a-4796-8963-94ef57113926</guid><dc:creator>manisha</dc:creator><description>&lt;p&gt;/*
* Copyright (c) 2016 Intel Corporation.  All rights reserved.
* See the bottom of this file for the license terms.
*/
// Enable debug prints to serial monitor
#define MY_DEBUG&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    //#define MY_DEBUG_VERBOSE_SIGNING
    #define MY_RADIO_NRF5_ESB
    
    
    
    #include &amp;lt;BLEPeripheral.h&amp;gt;
    #include &amp;lt;MySensors.h&amp;gt;
    #include &amp;lt;SPI.h&amp;gt;
    
    #define CHILD_ID 3
    #define CHILD_LED 4
    //#define BUTTON_PIN  3  // Arduino Digital I/O pin for button/reed switch
    // Change to V_LIGHT if you use S_LIGHT in presentation below
    MyMessage msg(CHILD_ID, V_LIGHT);
    MyMessage msgs(CHILD_LED, V_STATUS);
    
    BLEPeripheral blePeripheral;  // BLE Peripheral Device (the board you&amp;#39;re programming)
    BLEService ledService(&amp;quot;19B10000-E8F2-537E-4F6C-D104768A1214&amp;quot;); // BLE LED Service
    
    // BLE LED Switch Characteristic - custom 128-bit UUID, read and writable by central
    BLEUnsignedCharCharacteristic switchCharacteristic(&amp;quot;19B10001-E8F2-537E-4F6C-D104768A1214&amp;quot;, BLERead | BLEWrite | BLENotify);
    
    const int ledPin = 19; // pin to use for the LED
    int button = 18;
    static int count;
    int buttonstate;
    int ledPin1 = 20;
    
    
    void setup() {
      Serial.begin(115200);
    
      // set LED pin to output mode
      pinMode(ledPin, OUTPUT);
      pinMode(button, INPUT);
      pinMode(ledPin1,OUTPUT);
    
      // set advertised local name and service UUID:
      blePeripheral.setLocalName(&amp;quot;Irayya&amp;quot;);
      blePeripheral.setAdvertisedServiceUuid(ledService.uuid());
    
      // add service and characteristic:
      blePeripheral.addAttribute(ledService);
      blePeripheral.addAttribute(switchCharacteristic);
    
      // set the initial value for the characeristic:
      switchCharacteristic.setValue(0);
    
      // begin advertising BLE service:
      blePeripheral.begin();
    
      Serial.println(&amp;quot;BLE LED Peripheral&amp;quot;);
    }
    
    
    
    void loop() {
    
    
      buttonstate=digitalRead(button);
      if(buttonstate==HIGH)
      {
      
        
        //digitalWrite(ledPin,HIGH);
        digitalWrite(ledPin1,HIGH);
        Serial.println(&amp;quot;Now button state is high&amp;quot;);
       count=HIGH;                // using static variable to hold value because (pushbutton)
        //count=LOW;
        
      
      if(count==HIGH)
      {
      
      // listen for BLE peripherals to connect:
      Serial.println(&amp;quot;Now count state is high&amp;quot;);
      BLECentral central = blePeripheral.central();
    
      // if a central is connected to peripheral:
      if (central) {
        Serial.print(&amp;quot;Connected to central: &amp;quot;);
        // print the central&amp;#39;s MAC address:
        Serial.println(central.address());
        digitalWrite(ledPin,HIGH);
    
        // while the central is still connected to peripheral:
        while (central.connected()) {
          Serial.println(&amp;quot;central is connected&amp;quot;);
          // if the remote device wrote to the characteristic,
          // use the value to control the LED:
          if (switchCharacteristic.written()) {
            if (switchCharacteristic.value()) {   // any value other than 0
              Serial.println(&amp;quot;LED on&amp;quot;);
              digitalWrite(ledPin, HIGH);         // will turn the LED on
            } else {                              // a 0 value
              Serial.println(F(&amp;quot;LED off&amp;quot;));
              digitalWrite(ledPin, LOW);          // will turn the LED off
            }
          }
        }
    
        // when the central disconnects, print it out:
        Serial.print(F(&amp;quot;Disconnected from central: &amp;quot;));
        Serial.println(central.address());
        count=LOW;                              // after disconnect count should be low       
         Serial.println(&amp;quot;Now count state is LOW&amp;quot;);
        
        
      }
    }
      }
      
    if(count==LOW)
      {
       Serial.println(&amp;quot;Else part&amp;quot;);
      digitalWrite(ledPin, LOW); 
      present(CHILD_ID, S_LIGHT);
      present(CHILD_LED, S_TEMP);
      send(msg.set(&amp;quot;LOW&amp;quot;));
      delay(3000);
    
    }
    }
    void receive(const MyMessage &amp;amp;message)
    {
       Serial.println(&amp;quot;hello receive&amp;quot;);
      String command = message.data;
     
      Serial.println(command);
      Serial.println(&amp;quot;the msg type&amp;quot;);
      Serial.println(message.type);
    //  if (message.type == V_STATUS) {
    //    Serial.println(&amp;quot;RECV: &amp;quot;);
    //    String command = message.data;
    //    Serial.println(message.data);}
        if(command==&amp;quot;ON&amp;quot;)
        {
           Serial.println(&amp;quot;for enter to turn on led 1&amp;quot;);
        digitalWrite(ledPin1,HIGH);
        }
        if(command==&amp;quot;OFF&amp;quot;)
        {
          Serial.println(&amp;quot;for enter to turn OFF led 1&amp;quot;);
        digitalWrite(ledPin1,LOW);
        }
        send(msg.set(&amp;quot;OK&amp;quot;));
        send(msg.set(message.data));
    
    }
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using BLEPeripheral and MySensors libraries</title><link>https://devzone.nordicsemi.com/thread/115494?ContentTypeID=1</link><pubDate>Fri, 20 Oct 2017 12:38:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:664d14c1-e537-4ccd-aff3-5ce1f69c1d6c</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What is the code doing when you press the key?&lt;/li&gt;
&lt;li&gt;Could you share some code on what you are doing?&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>