@instalator:
@Securbond:
Похоже проблема в подключении к локалке, пока что не вижу шилда в сети …
Спасибо, сейчас попробую голый скетч залить. На всякий случай [http://forum.iobroker.net/viewtopic.php?f=33&t=1609](http://forum.iobroker.net/viewtopic.php?f=33&t=1609), мало ли)
не посмотришь где я косячу ?
! ````
#include <spi.h> // Ethernet shield
#include <ethernet.h> // Ethernet shield
#include <pubsubclient.h> // MQTT
#include <virtualwire.h>
#include <easytransfervirtualwire.h>
#include <wire.h>
#include <liquidcrystal_i2c.h>
LiquidCrystal_I2C lcd(0x27,16,2);
///
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
byte server[] = {192, 168, 0, 102}; //IP Брокера
IPAddress ip(192, 168, 0, 112);
! EthernetClient ethClient;
PubSubClient client(server, 1883, callback, ethClient);
#define id_connect "UNO_1"
#define Prefix_subscribe "UNO/Detskaya/"
! ////////////////////////////////////////////////////////////////////////////
void callback(char* topic, byte* payload, unsigned int length) {
payload[length] = '\0';
// Serial.print(topic);
// Serial.print("=");
String strTopic = String(topic);
String strPayload = String((char*)payload);
// Serial.println(strPayload);
callback_iobroker(strTopic, strPayload);
}
! ////////////////////////////////////////////////////////////////////////////
//create object
EasyTransferVirtualWire ET;
! struct SEND_DATA_STRUCTURE
{
//put your variable definitions here for the data you want to send
//THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
//Struct can'e be bigger then 26 bytes for VirtualWire version
byte ID;
long TemperatureBMP = 0;
long TemperatureDS = 0;
long Pressure = 0;
! };
! //give a name to the group of data
SEND_DATA_STRUCTURE mydata;
byte ID;
long TemperatureBMP = 0;
long TemperatureDS = 0;
long Pressure = 0;
! void setup(){
//start the library, pass in the data details
ET.begin(details(mydata));
Serial.begin(9600);
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000); // Bits per sec Скорость порта
vw_set_rx_pin(8); //порт к которому подключен приемник 433 мГц
vw_rx_start(); // Start the receiver PLL running
lcd.init(); // Инициализируем экран
lcd.backlight(); //Включаем подсветку
! Ethernet.begin(mac, ip);
if (client.connect(id_connect)) {
client.publish("UNO/Detskaya/Temp", "0");
client.publish("UNO/Detskaya/Pressure", "0");
client.subscribe("UNO/Detskaya/#");
}
}
! void loop(){
//check and see if a data packet has come in.
if(ET.receiveData()){
//this is how you access the variables. [name of the group].[variable name]
//since we have data, we will blink it out.
if (mydata.ID == 1)
{
int TempBMP= (mydata.TemperatureBMP);
TempBMP = ((TempBMP)/100);
float TempDS= (mydata.TemperatureDS);
TempDS = ((TempDS)/100);
float Pressure2= (mydata.Pressure);
Pressure2 = ((Pressure2)/100);
client.loop();
if (!client.connected()) {
if (client.connect(id_connect)) {
client.publish("UNO/Detskaya/Temp", TempDS);
client.publish("UNO/Detskaya/Pressure", Pressure2);
client.subscribe("UNO/Detskaya/#");
}
}
// Serial.print(TempBMP); //Вывод информации в COM порт
// Serial.println(", TempBMP:");
// Температуру в градусах Цельсия
Serial.print(TempDS);
Serial.print(" C°,");
// Температуру в градусах Цельсия
Serial.print(Pressure2);
Serial.print(" mm/");
//Выводим давление в мм.рт ст
Serial.println();
Serial.println();
delay(1000);
//Вывод информации на LCD Экран
lcd.clear();//очищаем экран от старых данных
lcd.setCursor(0,0);//Устанавливаем курсор в начало первой строки
lcd.print("T1:");//Выводим первую температуру
lcd.print(TempDS);
lcd.setCursor(8,0);// устанавливаем курсор на 8 позицию в первой строке
lcd.print(" T2:");//Выводим вторую температуру
lcd.print(TempBMP);
//аналогично выводим вторую строку
lcd.setCursor(0,1);//Устанавливаем курсор в начало второй строки
lcd.print("Davlenie:");//Выводим давление
lcd.print(Pressure2);
}
}
! }</liquidcrystal_i2c.h></wire.h></easytransfervirtualwire.h></virtualwire.h></pubsubclient.h></ethernet.h></spi.h>
Ругается -
>! priemnik433_E2.ino: In function 'void callback(char*, byte*, unsigned int)':
>! priemnik433_E2:28: error: 'callback_iobroker' was not declared in this scope
>! priemnik433_E2.ino: In function 'void loop()':
>! priemnik433_E2:96: error: no matching function for call to 'PubSubClient::publish(const char [18], float&)'
>! priemnik433_E2.ino:96:47: note: candidates are:
>! In file included from priemnik433_E2.ino:3:0:
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:117:12: note: boolean PubSubClient::publish(const char*, const char*)
>! boolean publish(const char* topic, const char* payload);
>! ^
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:117:12: note: no known conversion for argument 2 from 'float' to 'const char*'
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:118:12: note: boolean PubSubClient::publish(const char*, const char*, boolean)
>! boolean publish(const char* topic, const char* payload, boolean retained);
>! ^
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:118:12: note: candidate expects 3 arguments, 2 provided
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:119:12: note: boolean PubSubClient::publish(const char*, const uint8_t*, unsigned int)
>! boolean publish(const char* topic, const uint8_t * payload, unsigned int plength);
>! ^
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:119:12: note: candidate expects 3 arguments, 2 provided
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:120:12: note: boolean PubSubClient::publish(const char*, const uint8_t*, unsigned int, boolean)
>! boolean publish(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained);
>! ^
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:120:12: note: candidate expects 4 arguments, 2 provided
>! priemnik433_E2:97: error: no matching function for call to 'PubSubClient::publish(const char [22], float&)'
>! priemnik433_E2.ino:97:55: note: candidates are:
>! In file included from priemnik433_E2.ino:3:0:
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:117:12: note: boolean PubSubClient::publish(const char*, const char*)
>! boolean publish(const char* topic, const char* payload);
>! ^
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:117:12: note: no known conversion for argument 2 from 'float' to 'const char*'
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:118:12: note: boolean PubSubClient::publish(const char*, const char*, boolean)
>! boolean publish(const char* topic, const char* payload, boolean retained);
>! ^
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:118:12: note: candidate expects 3 arguments, 2 provided
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:119:12: note: boolean PubSubClient::publish(const char*, const uint8_t*, unsigned int)
>! boolean publish(const char* topic, const uint8_t * payload, unsigned int plength);
>! ^
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:119:12: note: candidate expects 3 arguments, 2 provided
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:120:12: note: boolean PubSubClient::publish(const char*, const uint8_t*, unsigned int, boolean)
>! boolean publish(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained);
>! ^
>! C:\Users\Bond-PC\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:120:12: note: candidate expects 4 arguments, 2 provided
>! 'callback_iobroker' was not declared in this scope