Jump to content









Photo

Arduino+CarriotsClients send temperature data

arduino CarriotsClients mega uno send data

  • Please log in to reply
No replies to this topic

#1 homerruma

homerruma

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 06 December 2014 - 09:34 AM

Hello friends
I'm new to this world.
 
How to write a variable temperature to CarriotsClients send data (sensors.getTempCByIndex (0)).
Thank you
My code:

 

#include <SPI.h>
#include <UIPEthernet.h>
 
#include <OneWire.h>
#include <DallasTemperature.h>
 
#include <SendCarriots.h>// You must include the library here in order to use it in the sketch
 
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
 
// Setup a oneWire instance to communicate with any OneWire devices 
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
 
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
 
const String APIKEY="1f6ce826c2bd4842988766cf073c581c0f69de28741c00527dac67dff9fbcbe5"; // Replace with your Carriots apikey
const String DEVICE="defaultDevice@homerruma.homerruma"; // Replace with the id_developer of your device
      
const int numElements=3; // Specify the number of rows in your array, in this case 3
 
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,211);       // Your IP Address
 
SendCarriots sender;              // Instantiate an instance of the SendCarriots library
 
void setup() {
  Serial.begin(9600);             // Start serial port
   // start serial port
  
  Serial.println("Dallas Temperature IC Control Library Demo");
 
  // Start up the library
  sensors.begin();
  
  Serial.println(F("Carriots Starting"));
  Ethernet.begin(mac,ip);         // Start the Ethernet connection
 
}
 
void loop() {
  {
 sensors.requestTemperatures(); // Send the command to get temperatures
 
  Serial.print("Temperature for Device 1 is: ");
  Serial.println(sensors.getTempCByIndex(0));
  Serial.print("Temperature for Device 2 is: ");
 Serial.println(sensors.getTempCByIndex(1)); // Why "byIndex"? 
    // You can have more than one IC on the same bus. 
    // 0 refers to the first IC on the wire
 delay(1000);
 
}
  String array[numElements][2] = {{"Polazna", "James"}, {"Age", "28"}, {"Gender", "Male"}};  // Define the values of the array to be sent
  Serial.println(sender.send(array, numElements, APIKEY, DEVICE));                 // Using the instance of the library, call the method send
  delay(10000);                                                                 // Send this stream every 10 seconds
}

 

 







Also tagged with one or more of these keywords: arduino, CarriotsClients, mega, uno, send, data

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users