Arduino Mega Server

Модератор: Alex

Neocivic
Сообщения: 72
Зарегистрирован: Вс апр 23, 2017 5:27 pm
Благодарил (а): 25 раз
Поблагодарили: 2 раза

Re: Arduino Mega Server

Сообщение Neocivic » Пн апр 24, 2017 11:33 pm

ВСЕМ ДОБРЫЙ ДЕНЬ! ПРОШУ ПОМОЩИ!!!

Третью ночь пытаюсь установить на Мегу 2560 в связке с Ethernet-шилдом AMS. Делал всё в точности, как в инструкции на hi-lab.ru, кроме:
1. Версия Arduino IDE 1.6.12. Стоит эта так-как версия 1.6.5 на Windows 10 отказалась работать;
2. А второго нет, остальное по инструкции.

При первой попытке компиляции, IDE пожаловалась на отсутствие ICMPPing.h. Я скачал эту библиотеку от сюда https://github.com/BlakeFoster/Arduino- ... /icmp_ping, установил и теперь IDE выдаёт следующие ошибки:
ВНИМАНИЕ: Категория '' в библиотеке Ethernet2 не является действительной. Установка на 'Uncategorized'
In file included from D:\Sketches\ams\Arduino\arduino_mega_server\arduino_mega_server.ino:115:0:

D:\Sketches\ams\Arduino\libraries\DS1307RTC/DS1307RTC.h:19:22: error: 'tmElements_t' has not been declared

static bool read(tmElements_t &tm);

^

D:\Sketches\ams\Arduino\libraries\DS1307RTC/DS1307RTC.h:20:23: error: 'tmElements_t' has not been declared

static bool write(tmElements_t &tm);

^

contacts:12: error: expected unqualified-id before numeric constant

#define CLOSE 0

^

D:\Sketches\ams\Arduino\libraries\Ethernet\src/utility/w5100.h:58:24: note: in expansion of macro 'CLOSE'

static const uint8_t CLOSE = 0x00;

^

ping:30: error: no matching function for call to 'ICMPPing::ICMPPing(SOCKET&)'

ICMPPing ping(pingSocket);

^

D:\Sketches\ams\Arduino\arduino_mega_server\ping.ino:30:25: note: candidates are:

In file included from D:\Sketches\ams\Arduino\arduino_mega_server\ping.ino:11:0:

D:\Sketches\ams\Arduino\libraries\icmp_ping/ICMPPing.h:138:5: note: ICMPPing::ICMPPing(SOCKET, uint8_t)

ICMPPing(SOCKET s, uint8_t id);

^

D:\Sketches\ams\Arduino\libraries\icmp_ping/ICMPPing.h:138:5: note: candidate expects 2 arguments, 1 provided

D:\Sketches\ams\Arduino\libraries\icmp_ping/ICMPPing.h:125:7: note: constexpr ICMPPing::ICMPPing(const ICMPPing&)

class ICMPPing

^

D:\Sketches\ams\Arduino\libraries\icmp_ping/ICMPPing.h:125:7: note: no known conversion for argument 1 from 'SOCKET {aka unsigned char}' to 'const ICMPPing&'

D:\Sketches\ams\Arduino\libraries\icmp_ping/ICMPPing.h:125:7: note: constexpr ICMPPing::ICMPPing(ICMPPing&&)

D:\Sketches\ams\Arduino\libraries\icmp_ping/ICMPPing.h:125:7: note: no known conversion for argument 1 from 'SOCKET {aka unsigned char}' to 'ICMPPing&&'

D:\Sketches\ams\Arduino\arduino_mega_server\ping.ino: In function 'void pingWorks()':

ping:42: error: no match for call to '(ICMPPing) (int, byte [4], char [64])'

online[countOnline] = ping(1, ips[countOnline], pingMessage);

^

In file included from D:\Sketches\ams\Arduino\arduino_mega_server\ping.ino:11:0:

D:\Sketches\ams\Arduino\libraries\icmp_ping/ICMPPing.h:125:7: note: candidates are:

class ICMPPing

^

D:\Sketches\ams\Arduino\libraries\icmp_ping/ICMPPing.h:165:19: note: ICMPEchoReply ICMPPing::operator()(const IPAddress&, int)

ICMPEchoReply operator()(const IPAddress&, int nRetries);

^

D:\Sketches\ams\Arduino\libraries\icmp_ping/ICMPPing.h:165:19: note: candidate expects 2 arguments, 3 provided

D:\Sketches\ams\Arduino\libraries\icmp_ping/ICMPPing.h:176:10: note: void ICMPPing::operator()(const IPAddress&, int, ICMPEchoReply&)

void operator()(const IPAddress& addr, int nRetries, ICMPEchoReply& result);

^

D:\Sketches\ams\Arduino\libraries\icmp_ping/ICMPPing.h:176:10: note: no known conversion for argument 3 from 'char [64]' to 'ICMPEchoReply&'

D:\Sketches\ams\Arduino\arduino_mega_server\rtc.ino: In function 'void rtcInit()':

rtc:10: error: 'setSyncProvider' was not declared in this scope

setSyncProvider(getNtpTime);

^

rtc:14: error: 'setSyncProvider' was not declared in this scope

setSyncProvider(RTC.get); // get time from RTC

^

D:\Sketches\ams\Arduino\arduino_mega_server\rtc.ino: In function 'void rtcSync()':

rtc:24: error: 'setSyncProvider' was not declared in this scope

setSyncProvider(getNtpTime);

^

rtc:26: error: 'timeStatus' was not declared in this scope

if (timeStatus() != timeNotSet) {

^

rtc:26: error: 'timeNotSet' was not declared in this scope

if (timeStatus() != timeNotSet) {

^

D:\Sketches\ams\Arduino\arduino_mega_server\rtc.ino: In function 'void serialRTC()':

rtc:42: error: 'year' was not declared in this scope

Serial.print(year());

^

rtc:44: error: 'month' was not declared in this scope

printDigits(month());

^

rtc:46: error: 'day' was not declared in this scope

printDigits(day());

^

rtc:48: error: 'hour' was not declared in this scope

printDigits(hour());

^

rtc:50: error: 'minute' was not declared in this scope

printDigits(minute());

^

rtc:52: error: 'second' was not declared in this scope

printDigits(second());

^

D:\Sketches\ams\Arduino\arduino_mega_server\rtc.ino: In function 'void showDuration(time_t)':

rtc:73: error: 'SECS_PER_DAY' was not declared in this scope

if(duration >= SECS_PER_DAY){

^

rtc:78: error: 'SECS_PER_HOUR' was not declared in this scope

if(duration >= SECS_PER_HOUR){

^

rtc:83: error: 'SECS_PER_MIN' was not declared in this scope

if(duration >= SECS_PER_MIN){

^

D:\Sketches\ams\Arduino\arduino_mega_server\rtc.ino: In function 'void checkEvent(time_t*)':

rtc:94: error: 'now' was not declared in this scope

time_t timeNow = now();

^

D:\Sketches\ams\Arduino\arduino_mega_server\rtc.ino: In function 'void setNtpInterval()':

rtc:149: error: 'timeStatus' was not declared in this scope

if (timeStatus() == timeNotSet) {

^

rtc:149: error: 'timeNotSet' was not declared in this scope

if (timeStatus() == timeNotSet) {

^

rtc:150: error: 'setSyncInterval' was not declared in this scope

setSyncInterval(18);

^

D:\Sketches\ams\Arduino\arduino_mega_server\server_ajax.ino: In function 'String makeTime()':

server_ajax:226: error: 'hour' was not declared in this scope

s += makeDigits(hour());

^

server_ajax:227: error: 'second' was not declared in this scope

if (second() % 2 == 0) {s += " ";}

^

server_ajax:229: error: 'minute' was not declared in this scope

s += makeDigits(minute());

^

D:\Sketches\ams\Arduino\arduino_mega_server\server_ajax.ino: In function 'void responseDash(EthernetClient)':

server_ajax:789: error: 'day' was not declared in this scope

s += makeTag("day", "", String(day()));

^

server_ajax:790: error: 'month' was not declared in this scope

s += makeTag("month", "", String(month()));

^

server_ajax:791: error: 'weekday' was not declared in this scope

s += makeTag("weekday", "", String(weekday()));

^

D:\Sketches\ams\Arduino\arduino_mega_server\tntp.ino: In function 'time_t getNtpTime()':

tntp:54: error: 'setSyncInterval' was not declared in this scope

setSyncInterval(3600);

^

tntp:55: error: 'SECS_PER_HOUR' was not declared in this scope

return secsSince1900 - 2208988800UL + timeZone * SECS_PER_HOUR;

^

tntp:59: error: 'setSyncInterval' was not declared in this scope

setSyncInterval(18);

^

D:\Sketches\ams\Arduino\arduino_mega_server\upload.ino: In function 'void uploadWorks()':

upload:160: error: 'setSyncProvider' was not declared in this scope

setSyncProvider(RTC.get);

^

upload:162: error: 'timeStatus' was not declared in this scope

if (timeStatus() != timeSet) {

^

upload:162: error: 'timeSet' was not declared in this scope

if (timeStatus() != timeSet) {

^

Несколько библиотек найдено для "Ethernet.h"
Используется: D:\Sketches\ams\Arduino\libraries\Ethernet
Не используется: C:\Program Files (x86)\Arduino\libraries\Ethernet
exit status 1
expected unqualified-id before numeric constant
Что я делаю не верно, подскажите!!!
Neocivic
Сообщения: 72
Зарегистрирован: Вс апр 23, 2017 5:27 pm
Благодарил (а): 25 раз
Поблагодарили: 2 раза

Re: Arduino Mega Server

Сообщение Neocivic » Вт апр 25, 2017 12:03 am

Arduino IDE обновила библиотеки и теперь выдаёт следующие ошибки:
ВНИМАНИЕ: Категория '' в библиотеке Ethernet2 не является действительной. Установка на 'Uncategorized'
In file included from D:\Sketches\ams\Arduino\arduino_mega_server\arduino_mega_server.ino:115:0:

D:\Sketches\ams\Arduino\libraries\DS1307RTC/DS1307RTC.h:19:22: error: 'tmElements_t' has not been declared

static bool read(tmElements_t &tm);

^

D:\Sketches\ams\Arduino\libraries\DS1307RTC/DS1307RTC.h:20:23: error: 'tmElements_t' has not been declared

static bool write(tmElements_t &tm);

^

D:\Sketches\ams\Arduino\arduino_mega_server\rtc.ino: In function 'void rtcInit()':

rtc:10: error: 'setSyncProvider' was not declared in this scope

setSyncProvider(getNtpTime);

^

rtc:14: error: 'setSyncProvider' was not declared in this scope

setSyncProvider(RTC.get); // get time from RTC

^

D:\Sketches\ams\Arduino\arduino_mega_server\rtc.ino: In function 'void rtcSync()':

rtc:24: error: 'setSyncProvider' was not declared in this scope

setSyncProvider(getNtpTime);

^

rtc:26: error: 'timeStatus' was not declared in this scope

if (timeStatus() != timeNotSet) {

^

rtc:26: error: 'timeNotSet' was not declared in this scope

if (timeStatus() != timeNotSet) {

^

D:\Sketches\ams\Arduino\arduino_mega_server\rtc.ino: In function 'void serialRTC()':

rtc:42: error: 'year' was not declared in this scope

Serial.print(year());

^

rtc:44: error: 'month' was not declared in this scope

printDigits(month());

^

rtc:46: error: 'day' was not declared in this scope

printDigits(day());

^

rtc:48: error: 'hour' was not declared in this scope

printDigits(hour());

^

rtc:50: error: 'minute' was not declared in this scope

printDigits(minute());

^

rtc:52: error: 'second' was not declared in this scope

printDigits(second());

^

D:\Sketches\ams\Arduino\arduino_mega_server\rtc.ino: In function 'void showDuration(time_t)':

rtc:73: error: 'SECS_PER_DAY' was not declared in this scope

if(duration >= SECS_PER_DAY){

^

rtc:78: error: 'SECS_PER_HOUR' was not declared in this scope

if(duration >= SECS_PER_HOUR){

^

rtc:83: error: 'SECS_PER_MIN' was not declared in this scope

if(duration >= SECS_PER_MIN){

^

D:\Sketches\ams\Arduino\arduino_mega_server\rtc.ino: In function 'void checkEvent(time_t*)':

rtc:94: error: 'now' was not declared in this scope

time_t timeNow = now();

^

D:\Sketches\ams\Arduino\arduino_mega_server\rtc.ino: In function 'void setNtpInterval()':

rtc:149: error: 'timeStatus' was not declared in this scope

if (timeStatus() == timeNotSet) {

^

rtc:149: error: 'timeNotSet' was not declared in this scope

if (timeStatus() == timeNotSet) {

^

rtc:150: error: 'setSyncInterval' was not declared in this scope

setSyncInterval(18);

^

D:\Sketches\ams\Arduino\arduino_mega_server\server_ajax.ino: In function 'String makeTime()':

server_ajax:226: error: 'hour' was not declared in this scope

s += makeDigits(hour());

^

server_ajax:227: error: 'second' was not declared in this scope

if (second() % 2 == 0) {s += " ";}

^

server_ajax:229: error: 'minute' was not declared in this scope

s += makeDigits(minute());

^

D:\Sketches\ams\Arduino\arduino_mega_server\server_ajax.ino: In function 'void responseDash(EthernetClient)':

server_ajax:789: error: 'day' was not declared in this scope

s += makeTag("day", "", String(day()));

^

server_ajax:790: error: 'month' was not declared in this scope

s += makeTag("month", "", String(month()));

^

server_ajax:791: error: 'weekday' was not declared in this scope

s += makeTag("weekday", "", String(weekday()));

^

D:\Sketches\ams\Arduino\arduino_mega_server\tntp.ino: In function 'time_t getNtpTime()':

tntp:54: error: 'setSyncInterval' was not declared in this scope

setSyncInterval(3600);

^

tntp:55: error: 'SECS_PER_HOUR' was not declared in this scope

return secsSince1900 - 2208988800UL + timeZone * SECS_PER_HOUR;

^

tntp:59: error: 'setSyncInterval' was not declared in this scope

setSyncInterval(18);

^

D:\Sketches\ams\Arduino\arduino_mega_server\upload.ino: In function 'void uploadWorks()':

upload:160: error: 'setSyncProvider' was not declared in this scope

setSyncProvider(RTC.get);

^

upload:162: error: 'timeStatus' was not declared in this scope

if (timeStatus() != timeSet) {

^

upload:162: error: 'timeSet' was not declared in this scope

if (timeStatus() != timeSet) {

^

Несколько библиотек найдено для "Ethernet.h"
Используется: D:\Sketches\ams\Arduino\libraries\Ethernet
Не используется: C:\Program Files (x86)\Arduino\libraries\Ethernet
exit status 1
'setSyncProvider' was not declared in this scope
Где задекларировать эти переменные? Что нужно дать этой программе, чтобы она заработала?
Аватара пользователя
nick7zmail
Сообщения: 7573
Зарегистрирован: Пн окт 28, 2013 8:14 am
Откуда: Екатеринбург
Благодарил (а): 121 раз
Поблагодарили: 2010 раз

Re: Arduino Mega Server

Сообщение nick7zmail » Вт апр 25, 2017 5:05 am

Библиотеку Time в TimeLib переименуйте...либо скачайте переименованную...где то в районе 160 страницы +- 20 было...у меня на старших версиях Ide решило эти проблемы...

Либо пробуйте запустить 1.6.5...она на 10ке у меня от имени администратора вроде запускалась...обычным кликом не хотела...или наоборот ли...уже не помню, давно было.
Последний раз редактировалось nick7zmail Вт апр 25, 2017 11:17 am, всего редактировалось 1 раз.
За это сообщение автора nick7zmail поблагодарил:
Neocivic (Вт апр 25, 2017 10:22 am)
Рейтинг: 1.16%
Raspberry Pi3+Broadlink+esp8266 (blynk)+AMS
Если вам помогло какое-либо сообщение - не забывайте пользоваться кнопкой "СПАСИБО".
:arrow: Услуги в профиле коннект
>>>>>Мой новый канал на ютутбе, подписывайтесь!<<<<<
Neocivic
Сообщения: 72
Зарегистрирован: Вс апр 23, 2017 5:27 pm
Благодарил (а): 25 раз
Поблагодарили: 2 раза

Re: Arduino Mega Server

Сообщение Neocivic » Вт апр 25, 2017 10:22 am

nick7zmail писал(а):Библиотеку Time в TimeLib переименуйте...либо скачайте переименованную...где то в районе 160 страници +- 20 было...у меня на старших версиях Ide решило эти проблемы...

Либо пробуйте запустить 1.6.5...она на 10ке у меня от имени администратора вроде запускалась...обычным кликом не хотела...или наоборот ли...уже не помню, давно было.
ОГРОМНОЕ Вам спасибо! Всё заработало.

Для справки, может кому-то из начинающих, как я, поможет:
1. Arduino IDE v.1.6.12 (с неё всё залилось на Мегу2560);
2. Изначально ошибка была из-за устаревших библиотек. Сначала мной была подключена библиотека ICMPPing.h. Скачена от сюда: https://github.com/BlakeFoster/Arduino- ... /icmp_ping ;
3. Ошибка не исчезла, а IDE сама предложила обновить какие-то библиотеки, какие не знаю, просто нажал обновить И ОШИБКА СМЕНИЛАСЬ (пост выше);
4. Подключил новую библиотеку Timelib, скачал от сюда: https://github.com/PaulStoffregen/Time В моей старой библиотеке не было файла TimeLib.h
5. Вуаля - всё залилось на Мегу. Спасибо nick7zmail !

Хочу отметить для чайников, таких как я, библиотеку нужно не просто установить, но и подключить к Скетчу - Закладка в IDE Скетч/Подключить библиотеку/<Выбираем нужную>.
serghei
Сообщения: 2575
Зарегистрирован: Пт ноя 06, 2015 10:22 am
Откуда: Кишинёв
Благодарил (а): 303 раза
Поблагодарили: 282 раза

Re: Arduino Mega Server

Сообщение serghei » Сб май 06, 2017 8:39 am

Приветствую Всех. Не только у меня есть проблема с синхронизацией времени АМС. Причем эта проблема только на платформе Mega и Due. Во всех версиях от 013 до 016. На ESP всех вариантов такой проблемы нет. ( Если только не учитывать переход на летнее время).
В ESP используется выбор сервера NTP по имени . Простая подстановка другого IP в Мегу проблемы не решает. Так же проверил на всех провайдерах в стране. Сеть настроена правильно ( у меня основной шлюз 192.168.2.100 , в скетче заменён ). Если просто пинговать IP NTP сервера из скетча Меги - превышено время запроса. Переписать код с ESP под WI-FI на Етернет-модуль знаний не хватает.
И судя по скринам у очень многих пользователей нет синхронизации. При этом не возможно пользоваться Историей значений.
В чем может быть проблема? И ещё. При подключении АМС к МД время должно браться с 8888 порта. А как его настроить? Это в самой винде или в МД ? Данные передаются , время нет.
Помогите пожалуйста разобраться.

И в догонку. Вставил в плиточный интерфейс Дуи аналоговые часики на JS. Тикают идеально )) Значит код на странице АМС видит время компа правильно. Другой вопрос , что они отображаются в Опере только под ХР. На семерке и Опере не хотят. Хотя если вывести на отдельную страницу - все нормально. Ну тут скорее проблема в альтернативном CSS или JS. А может и в браузере , хотя под FF тоже не хотят показываться (((
AMS : ESP32 + NRF24 + 1Wire-I2C мост DS2482 + счетчик DS2423 + сеть MySensors + редактирование страниц в браузере + Upload по воздуху + SPIFFS
Аватара пользователя
ser009
Сообщения: 595
Зарегистрирован: Сб окт 13, 2012 9:55 am
Благодарил (а): 4 раза
Поблагодарили: 43 раза

Re: Arduino Mega Server

Сообщение ser009 » Чт май 18, 2017 2:31 pm

В общем вот ссылка
http://skylarkrussia.tv/support/ntp_server_activation/

Попробуй на локальном компе активировать NTP сервер и обращаться к нему.
Должно получиться.
Аватара пользователя
ser009
Сообщения: 595
Зарегистрирован: Сб окт 13, 2012 9:55 am
Благодарил (а): 4 раза
Поблагодарили: 43 раза

Re: Arduino Mega Server

Сообщение ser009 » Чт май 18, 2017 2:41 pm

Сейчас занимаюсь клиентом для теплицы.
Для начала простой полив воды в заданное время + монтаж в коммуникаций в теплице.
Сейчас на этапе написания алгоритмов и визуализации.
Исполнительные элементы системы полива закуплены. Едут с Китая.

Кому интересна тема присоединяйтесь. Нужна помощь в оформлении странички.
СпойлерПоказать
теплица.jpg
теплица.jpg (81.44 КБ) 10666 просмотров
Alex
Сообщения: 2357
Зарегистрирован: Пт апр 20, 2012 12:53 pm
Благодарил (а): 42 раза
Поблагодарили: 262 раза

Re: Arduino Mega Server

Сообщение Alex » Чт май 18, 2017 3:33 pm

Приветствую Всех. Не только у меня есть проблема с синхронизацией времени АМС. Причем эта проблема только на платформе Mega и Due. Во всех версиях от 013 до 016. На ESP всех вариантов такой проблемы нет.
Стоп! У меня лично на множестве проектов и у множества моих клиентов никаких проблем с синхронизацией времени нет. Отлично работают все последние стандартные версии. Максимум что бывает — синхронизируется не с первого раза, но в течение нескольких минут синхронизируется 100%.
В чем может быть проблема?
В вашем оборудовании или провайдере или модификациях АМС.
При подключении АМС к МД время должно браться с 8888 порта. А как его настроить? Это в самой винде или в МД ? Данные передаются , время нет.
Ничего настраивать не надо. Комп под ХР с MajorDoMo сам всё выдаёт без каких-либо дополнительных телодвижений.
serghei
Сообщения: 2575
Зарегистрирован: Пт ноя 06, 2015 10:22 am
Откуда: Кишинёв
Благодарил (а): 303 раза
Поблагодарили: 282 раза

Re: Arduino Mega Server

Сообщение serghei » Чт май 18, 2017 10:05 pm

Alex , все таки мы живем в разных странах , но ломимся на один NTP сервер ;) . Если бы проблема была в моем оборудовании или провайдере , то и ESP не синхронизировалась бы. Я мало что понимаю в настройках сети , но в скетче у нас всего " две педали " - локальный IP адрес АМС и адрес Гейтвея. DNS закомментирован. Если уж ЕСП умеет быть точкой доступа , то мне кажется она на железном уровне получает DNS от рутера.
Через две недели я попаду к человеку в умный дом и проверю свою машинку там. У него 4 АМС на Меге синхронизируются........

Прописал гугловский DNS и все равно не хочет....То есть получается у АМС нет доступа в интернет ? , только локалка. На ЕСП проверил модуль " Chart" - отлично работает. Пробую перенести на SD-карту и запустить на Меге. Там явно будет видно.
За это сообщение автора serghei поблагодарил:
k_w_m (Пт май 19, 2017 2:40 pm)
Рейтинг: 1.16%
AMS : ESP32 + NRF24 + 1Wire-I2C мост DS2482 + счетчик DS2423 + сеть MySensors + редактирование страниц в браузере + Upload по воздуху + SPIFFS
Аватара пользователя
ser009
Сообщения: 595
Зарегистрирован: Сб окт 13, 2012 9:55 am
Благодарил (а): 4 раза
Поблагодарили: 43 раза

Re: Arduino Mega Server

Сообщение ser009 » Сб май 20, 2017 4:14 am

serghei писал(а):То есть получается у АМС нет доступа в интернет ? , только локалка. .
Если не получается сихронизироваться через интернет, сделай NTP сервер в локалке. Есть роутеры умеющие выступать в качестве сервера NTP (например MikroTik). На крайний случай пробуй как я писал выше. Настрой локальный ПК и обращайся к нему.

Проверь трассировку. https://sprinthost.ru/support/howto/tracert.html
Ответить