• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Uno,ethernet,thingspeak
#1
Witam jestem początkujący jeśli chodzi o programowanie.
Mam problem z wysyłaniem danych do thingspeaka,,
Po jakimś czasie po prostu przestają przychodzić tutaj kod i link do thingspeaka :
Kod:
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <EtherCard.h>

#define BACKLIGHT_PIN 3

#define lm35_1_pin 0
#define lm35_2_pin 1

static byte mymac[] = { 0x74,0x69,0x69,0x9D,0x30,0x30 };


LiquidCrystal_I2C lcd(0x27, 2,1,0,4,5,6,7);
const byte tempddress[8]={0x28, 0xFF, 0xFE, 0x63, 0x61, 0x15, 0x2, 0xF5};
const byte tempddress1[8]={0x28, 0xFF, 0xFE, 0x63, 0x61, 0x15, 0x2, 0xF5};
static uint16_t port = 80;
byte Ethernet::buffer[600];
static uint32_t timer;
const char website[] PROGMEM = "api.thingspeak.com";

void my_callback (byte status, word off, word len) {
Serial.println(">>>");
Ethernet::buffer[off+300] = 0;
Serial.print((const char*) Ethernet::buffer + off);
Serial.println("...");


}
void setup(){
 Serial.begin(57600);
     lcd.begin(16,2);
   
 lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
 lcd.setBacklight(HIGH);
 //Now register handlers for all keys
 
 
 // The first requests sensor for measurement

 lcd.setCursor(0,0);
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
 lcd.print(F("Blad sieci"));
   
 lcd.print(F("Init DHCP"));
 if (!ether.dhcpSetup()){
   lcd.clear();
 lcd.print(F("Bland DHCP"));}
 if (!ether.dnsLookup(website))
    lcd.print("DNS fail");
 else{
 lcd.setCursor(0,1);
//  lcd.print(DisplayAddress(ether.myip));
 delay(5000);
 }
lcd.clear();
 lcd.home();
lcd.print("Marcin Malec");
delay(1000);

//  client.setDataArrivedDelegate();
}
void loop(){

ether.packetLoop(ether.packetReceive());

lcd.setCursor(0,0);
  int lm35_1;
  int lm35_2;
float temperatura_1;
float temperatura_2;
//  
  lcd.setCursor(0,1);

     lm35_1 = analogRead(lm35_1_pin);
     temperatura_1 = (5.0 * lm35_1 * 100.0)/1024.0;  
     lm35_2 = analogRead(lm35_2_pin);
     temperatura_2 = (5.0 * lm35_2 * 100.0)/1024.0;      
   
     // Sprawdzamy czy są odczytane wartości
     if (isnan(temperatura_1) || isnan(temperatura_2))
     {
       // Jeśli nie, wyświetlamy informację o błędzie
       Serial.println("Blad odczytu danych z czujnika");
     } else
     {
       // Jeśli tak, wyświetlamy wyniki pomiaru
       delay(3000);
       lcd.home();
       lcd.setCursor(0,0);
         lcd.print(temperatura_1);
         lcd.print(" C piec");
         lcd.setCursor(0,1);
         lcd.print(temperatura_2);
         lcd.print(" C grzejnik");
     }
   if (millis() > timer) {
  timer = millis() + 500;
  int myInt = temperatura_1;  
  char myIntAsString[15];
  itoa(myInt, myIntAsString, 10);
 
  int myInt1 = temperatura_2;  
  char myIntAsString1[20];
  itoa(myInt1, myIntAsString1, 10);
 
  ether.browseUrl(PSTR("/update?key=MP4103K0CBASUB3N&field1="), myIntAsString, website,my_callback);
  ether.browseUrl(PSTR("/update?key=MP4103K0CBASUB3N&field2="), myIntAsString1, website,my_callback);
       
   }}

https://thingspeak.com/channels/112128
Będę wdzięczny za pomoc i wskazówki

To nie jest portal ogłoszeniowy , najwyraźniej nikt nie ma dla ciebie pomocnej informacji .

P.s. sprawdź czy jest to po stronie arduino ( zawiesza się ) czy połączenie jest zrywane i go nie wznawia
 
Odpowiedź
  


Skocz do:


Przeglądający: 1 gości