<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Arduino with Splunk in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Arduino-with-Splunk/m-p/346934#M5456</link>
    <description>&lt;P&gt;@macalamela, I edited your question to mask your IP address, API key, and password.  These items should not be published in a public forum like this one.&lt;/P&gt;</description>
    <pubDate>Sat, 23 Sep 2017 20:07:52 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2017-09-23T20:07:52Z</dc:date>
    <item>
      <title>Arduino with Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Arduino-with-Splunk/m-p/346933#M5455</link>
      <description>&lt;P&gt;hello, we are trying to use splunk with arduino by wifi (esp8266). We utilized the port 8088 and this code but don´t recognize this port and send to port 443.&lt;/P&gt;

&lt;P&gt;But we have some problems and we can't connect they both together. Can you have some example by how we can connect that?&lt;/P&gt;

&lt;P&gt;We try using this code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/*  Medidor de temperatura com LM35, ESP8266 e Thingspeak
 *  
 *  Envia a temperatura lida pelo sensor LM35 e envia para a internet 
 *  com o auxilio da platarforma de Cloud do Thingspeak.
 *  
 *  library modified 23 Mar 2016 on Arduino IDE 1.6.7
 *  by Cléber Werlang (http://iot4nerds.wordpress.com/)
 */

#include               // Biblioteca do ESP8266
#include "Limits.h"

String apiKey = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";   //Coloque a API do ThingSpeak entre as aspas
const char* ssid = "Renato iPhone 5s";            //Coloque a ssid do Wifi entre as aspas.
const char* password = "xxxxxxxxxxx";       //Coloque a senha do Wifi entre as aspas.
const char* server = "nnn,nnn,nn,172";


const int sensorTemp = A0; //Pino analógico que o sensor de temperatura está conectado.
int valorSensorTemp = 0;  //usada para ler o valor do sensor de temperatura.
int menorValorTemp  = INT_MAX; //usada para armazenar o menor valor da temperatura.



WiFiClient client;

void setup() {
  Serial.begin(115200);
  delay(10);

  WiFi.begin(ssid, password);

  Serial.println();
  Serial.println();
  Serial.print("Conectando em ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(100);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("Conectado!");

}

void loop() {

  Serial.println("Lendo temperatura!");


 //Para evitar as grandes variações de leitura do componente 
  //LM35 são feitas 8 leitura é o menor valor lido prevalece.  
  menorValorTemp  = INT_MAX; //Inicializando com o maior valor int possível
  for (int i = 1; i &amp;lt;= 8; i++) {
    //Lendo o valor do sensor de temperatura.
    valorSensorTemp = analogRead(sensorTemp);   

    //Transformando valor lido no sensor de temperatura em graus celsius aproximados.
    valorSensorTemp *= 0.54 ; 

    //Mantendo sempre a menor temperatura lida
    if (valorSensorTemp &amp;lt; menorValorTemp) {
      menorValorTemp = valorSensorTemp;
    }

   delay(150); 
  }   


    String postStr = apiKey;
           postStr +="&amp;amp;field1=";
           postStr += String(menorValorTemp);
           postStr += "\r\n\r\n";

     client.connect("https://nnn,nnn,nn,172",8088);
     client.println("POST /1/inputs/http?index=&amp;lt;arduino&amp;gt;&amp;amp;sourcetype=arduino&amp;amp;host=arduino");
     client.println("Authorization: Splunk &amp;lt;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&amp;gt;");
     /client.print("Authorization: Splunk "+apiKey);/
      client.print(postStr.length());
     client.println("Content-Type: text/plain");
     client.println("Connection: close");
     client.println("");
     client.println(postStr);

     Serial.println("");
     Serial.print("Temperatura: ");        //Imprime a temperatura na Serial.
     Serial.print(menorValorTemp);                  
     Serial.println("C");
     Serial.println("Enviando para o ThingSpeak");

  client.stop();                     
  delay(14000);                           // thingspeak tem um delay de 14 segundos para os updates.
  Serial.println("Enviado!");
  Serial.println("");
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 23 Sep 2017 00:07:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Arduino-with-Splunk/m-p/346933#M5455</guid>
      <dc:creator>macalamela</dc:creator>
      <dc:date>2017-09-23T00:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Arduino with Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Arduino-with-Splunk/m-p/346934#M5456</link>
      <description>&lt;P&gt;@macalamela, I edited your question to mask your IP address, API key, and password.  These items should not be published in a public forum like this one.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2017 20:07:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Arduino-with-Splunk/m-p/346934#M5456</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-09-23T20:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Arduino with Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Arduino-with-Splunk/m-p/346935#M5457</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Have you tried using the &lt;STRONG&gt;WiFiClientSecure&lt;/STRONG&gt; instead of &lt;STRONG&gt;WiFiClient&lt;/STRONG&gt;? It is quite a while since ive looked at this sort of thing, however this could be part of the issue. This is assuming your receiver is indeed HTTPS.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2017 21:22:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Arduino-with-Splunk/m-p/346935#M5457</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2017-09-23T21:22:23Z</dc:date>
    </item>
  </channel>
</rss>

