<?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>Temperature code into Light Lightness Server code</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/82215/temperature-code-into-light-lightness-server-code</link><description>Hi 
 I am using sht85 to detect temperature/humidity in my Light lightness server code 
 In the original server code, by pressing 1 or 2 you get to either decrease or increase the lightness level respectively. I modified the code so that when number 3</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Dec 2021 02:45:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/82215/temperature-code-into-light-lightness-server-code" /><item><title>RE: Temperature code into Light Lightness Server code</title><link>https://devzone.nordicsemi.com/thread/341605?ContentTypeID=1</link><pubDate>Thu, 02 Dec 2021 02:45:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dfc1e593-7d7c-456a-8f63-3180b6a2e66c</guid><dc:creator>kyle goldsteins</dc:creator><description>&lt;p&gt;HI Vidar,&lt;/p&gt;
&lt;p&gt;Thanks for your help. I have managed to resolve this issue !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Temperature code into Light Lightness Server code</title><link>https://devzone.nordicsemi.com/thread/341453?ContentTypeID=1</link><pubDate>Wed, 01 Dec 2021 09:07:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:857e0154-4451-4a4b-88d4-4984adf5e25c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;-1 corresponds to &amp;#39;&lt;span class="pl-en"&gt;STATUS_ERR_BAD_DATA&lt;/span&gt; &amp;#39; according to the sht3x.h header: &lt;a href="https://github.com/Sensirion/embedded-sht/blob/fcc8a523210cc1241a2750899ff6b0f68f3ed212/sht3x/sht3x.h#L53"&gt;https://github.com/Sensirion/embedded-sht/blob/fcc8a523210cc1241a2750899ff6b0f68f3ed212/sht3x/sht3x.h#L53&lt;/a&gt;. So the next step should probably to debug the function to see where the error is returned.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Temperature code into Light Lightness Server code</title><link>https://devzone.nordicsemi.com/thread/341442?ContentTypeID=1</link><pubDate>Wed, 01 Dec 2021 08:07:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63e985ad-fd58-4003-a424-a66392ea34a5</guid><dc:creator>kyle goldsteins</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;&lt;img height="106" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1638345802148v1.png" width="446" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;I got an error of -1. If I am not wrong ret is supposed to be 0 right? Since STATUS_OK is defined as 0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Temperature code into Light Lightness Server code</title><link>https://devzone.nordicsemi.com/thread/341437?ContentTypeID=1</link><pubDate>Wed, 01 Dec 2021 07:54:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6b40218-a7db-4232-b065-d4c60fdfd30f</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Please try again with the blocking read (sht3x_measure_blocking_read) and check if it returns with an error.&lt;/p&gt;
&lt;p&gt;e.g.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; if(button_number == 3)
    {
              int32_t temperature, humidity;
               int32_t temp_read, hum_read;
                  char temp_str[5];
                  char hum_str[5];
        
           int8_t ret = sht3x_measure_blocking_read(SHT3X_I2C_ADDR_DFLT,
                                                 &amp;amp;temperature, &amp;amp;humidity);
               if (ret == STATUS_OK) {
                temp_read = temperature / 1000;
                hum_read = humidity / 1000; 
                  
                  
                // itoa(temp_read, temp_str,10); // Reduntant. The __LOG macro will do the conversion
                // itoa(hum_read, hum_str, 10);
               __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Temperature: %d\n&amp;quot;, temperature);
               __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Humidity: %d\n&amp;quot;, humidity);  
         
              } else {
                   __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;sht3x_measure_blocking_read() failed. Error: %d\n&amp;quot;, ret);
              }

      }  &lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Temperature code into Light Lightness Server code</title><link>https://devzone.nordicsemi.com/thread/341422?ContentTypeID=1</link><pubDate>Wed, 01 Dec 2021 01:52:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81404272-feff-400a-9013-1cf705a1b313</guid><dc:creator>kyle goldsteins</dc:creator><description>&lt;p&gt;HI Vidar,&lt;/p&gt;
&lt;p&gt;Thank you for your prompt reply ! I did the changes that you told me to do. However, the temperature values that appear in the J-Link appear to be just 0 even after pressing button 3 a few times.&lt;/p&gt;
&lt;p&gt;As such, instead of putting &amp;#39;temperature&amp;#39; in the LOG, i tried it with &amp;#39;temp_read&amp;#39; instead. Here is the code.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(button_number == 3)
    {
              int32_t temperature, humidity;
              int32_t temp_read, hum_read;
                  char temp_str[5];
                  char hum_str[5];
        
              int8_t ret = sht3x_read(SHT3X_I2C_ADDR_DFLT,
                                           &amp;amp;temperature, &amp;amp;humidity);

               if (ret == STATUS_OK) {
                 temp_read = temperature / 1000 ;
                //hum_read = humidity / 1000;  I removed humidity for this test first
                  
                // itoa(temp_read, temp_str,10);
                // itoa(hum_read, hum_str, 10);
                 
              }
              __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Temperature: %d\n&amp;quot;, temp_read); 
      }   &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Ultimately, I managed to get something in the output. However I realized that the output is always goes in one loop from 0-255. Every time I press button 3, the temperature seems to increase until 255 before going back to 0 and starting all over again as shown in the picture&amp;nbsp;here&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img height="267" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1638323358908v2.png" width="357" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Any possible solutions to this? Your help is much appreciated&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Temperature code into Light Lightness Server code</title><link>https://devzone.nordicsemi.com/thread/341303?ContentTypeID=1</link><pubDate>Tue, 30 Nov 2021 13:18:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bead3272-7b14-4962-91f4-0f3bb753bdd6</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It looks like you are printing the RAM address to where &amp;#39;temp_str&amp;#39; and &amp;#39;hum_str&amp;#39; are stored in RAM rather than printing the content of those arrays. Try this instead:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; if(button_number == 3)
    {
              int32_t temperature, humidity;
               int32_t temp_read, hum_read;
                  char temp_str[5];
                  char hum_str[5];
        
           int8_t ret = sht3x_measure_blocking_read(SHT3X_I2C_ADDR_DFLT,
                                                 &amp;amp;temperature, &amp;amp;humidity);
               if (ret == STATUS_OK) {
                temp_read = temperature / 1000;
                hum_read = humidity / 1000; 
                  
                  
                // itoa(temp_read, temp_str,10); // Reduntant. The __LOG macro will do the conversion
                // itoa(hum_read, hum_str, 10);
                  
         

              }
          __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Temperature: %d\n&amp;quot;, temperature);
         __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Humidity: %d\n&amp;quot;, humidity);
      }   &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>