Error time was not declared in this scope

Ошибка [Error] 'time' was not declared in this scope C++ Решение и ответ на вопрос 2751994

spasi_i_sohrani

0 / 0 / 0

Регистрация: 14.12.2020

Сообщений: 6

1

14.12.2020, 20:24. Показов 7436. Ответов 8

Метки нет (Все метки)


C++
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
using namespace std;
 
int main(){
   srand(time(0));
   int x;
   x=rand()%6+1;
   cout << "The dice were rolled " << x <<"n";
   system("pause");
   return 0;
}

Ошибка [Error] ‘time’ was not declared in this scope

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Verevkin

Нарушитель

8388 / 4391 / 1009

Регистрация: 12.03.2015

Сообщений: 20,566

14.12.2020, 21:07

2

Цитата
Сообщение от spasi_i_sohrani
Посмотреть сообщение

Ошибка [Error] ‘time’ was not declared in this scope

C++
1
#include <time.h>



1



Yetty

7423 / 5018 / 2890

Регистрация: 18.12.2017

Сообщений: 15,694

15.12.2020, 04:33

3

это не С++

Цитата
Сообщение от Verevkin
Посмотреть сообщение

#include <time.h>

C++
1
#include <сtime>



0



spasi_i_sohrani

0 / 0 / 0

Регистрация: 14.12.2020

Сообщений: 6

15.12.2020, 19:43

 [ТС]

4

Цитата
Сообщение от Verevkin
Посмотреть сообщение

C++
1
#include <time.h>

Не сработало



0



Нарушитель

8388 / 4391 / 1009

Регистрация: 12.03.2015

Сообщений: 20,566

15.12.2020, 19:46

5

Цитата
Сообщение от spasi_i_sohrani
Посмотреть сообщение

Не сработало

неужели та же ошибка?



0



0 / 0 / 0

Регистрация: 14.12.2020

Сообщений: 6

15.12.2020, 19:49

 [ТС]

6

[Error] сtime: No such file or directory



0



Verevkin

Нарушитель

8388 / 4391 / 1009

Регистрация: 12.03.2015

Сообщений: 20,566

15.12.2020, 19:55

7

Лучший ответ Сообщение было отмечено spasi_i_sohrani как решение

Решение

Цитата
Сообщение от spasi_i_sohrani
Посмотреть сообщение

[Error] сtime: No such file or directory

C++
1
#include <time.h>

Ошибка [Error] 'time' was not declared in this scope



1



0 / 0 / 0

Регистрация: 14.12.2020

Сообщений: 6

15.12.2020, 20:01

 [ТС]

8

Спасибо! После iostream не прописала stdlib, теперь работает



0



Нарушитель

8388 / 4391 / 1009

Регистрация: 12.03.2015

Сообщений: 20,566

15.12.2020, 20:07

9

Цитата
Сообщение от spasi_i_sohrani
Посмотреть сообщение

После iostream не прописала stdlib



0



IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

15.12.2020, 20:07

9

  • #1

АХТУНГ!
Вставка от модератора:
Подробное руководство по загрузке прошивки в Ардуино от Алекса Гайвера:

Прежде чем строчить сообщения, внимательно ознакомьтесь!!!

=====================================================================================================

Здраствуйте, у меня возникла ошибка с компиляцией скетча, всё сделал по инструкции, несколько раз всё перепроверил, но всё равно возникает ошибка
Arduino: 1.6.4 (Windows 7), Плата»Arduino Nano, ATmega328″

In file included from C:Program FilesArduinolibrariesLCD_1602_RUS-master/LCD_1602_RUS.h:1:0,
from money_box_counter.ino:35:
C:Program FilesArduinolibrariesLCD_1602_RUS-master/LiquidCrystal_I2C.h:7:18: fatal error: Wire.h: No such file or directory
#include <Wire.h>
^
compilation terminated.
Ошибка компиляции.

Безымянный.png

Изменено: 19 Мар 2020

  • #2

Написано же четко.
fatal error: Wire.h: No such file or directory
#include <Wire.h>
библеотека Wire.h — Данный файл или каталог отсутствует

  • #3

Не могу запрограммировать Arduino. Не было под рукой всех нужных деталей,поэтому сделал на микрофоне,который Алекс НЕ советовал,но вариантов не было. Суть не в этом. Вылезает ошибка компиляции. Библиотеки заново копировал по нескольку раз и не помогает. С проектом Ambilight тоже была такая же проблема. Не мог найти какой-то файл. Что делать? OTdrAa-0H7k.jpg1546930986412.png

  • #4

Всем привет!

Нужна помощь, скетч «CUBE_Gyver.ino» грузится на ура, а вот «CUBE_Gyver_v2.ino». Библиотека GyverButton взята из архива с проектом.

G:LEDcube-masterCUBE_Gyver_v2CUBE_Gyver_v2.ino: In function ‘void setup()’:

CUBE_Gyver_v2:132:9: error: ‘class GButton’ has no member named ‘setStepTimeout’

butt1.setStepTimeout(100); // настрйока интервала инкремента (по умолчанию 800 мс)

^

CUBE_Gyver_v2:133:9: error: ‘class GButton’ has no member named ‘setStepTimeout’

butt2.setStepTimeout(100); // настрйока интервала инкремента (по умолчанию 800 мс)

^

G:LEDcube-masterCUBE_Gyver_v2CUBE_Gyver_v2.ino: In function ‘void loop()’:

CUBE_Gyver_v2:144:13: error: ‘class GButton’ has no member named ‘isClick’

if (butt1.isClick()) {

^

CUBE_Gyver_v2:149:13: error: ‘class GButton’ has no member named ‘isClick’

if (butt2.isClick()) {

^

CUBE_Gyver_v2:155:13: error: ‘class GButton’ has no member named ‘isStep’

if (butt1.isStep()) { // если кнопка была удержана (это для инкремента)

^

CUBE_Gyver_v2:158:13: error: ‘class GButton’ has no member named ‘isStep’

if (butt2.isStep()) { // если кнопка была удержана (это для инкремента)

^

Используем библиотеку SPI версии 1.0 из папки: C:Program Files (x86)ArduinohardwarearduinoavrlibrariesSPI
Используем библиотеку GyverButton в папке: C:Program Files (x86)ArduinolibrariesGyverButton (legacy)
Используем библиотеку GyverHacks в папке: C:Program Files (x86)ArduinolibrariesGyverHacks (legacy)
Используем библиотеку GyverTimer в папке: C:Program Files (x86)ArduinolibrariesGyverTimer (legacy)
Используем библиотеку EEPROM версии 2.0 из папки: C:Program Files (x86)ArduinohardwarearduinoavrlibrariesEEPROM
exit status 1
‘class GButton’ has no member named ‘setStepTimeout’

Если брать самую последнюю версию библиотеки GyverButton отсюда https://community.alexgyver.ru/resources/biblioteka-gyverbutton.1/

для CUBE_Gyver.ino

G:LEDcube-masterCUBE_GyverCUBE_Gyver.ino: In function ‘void setup()’:

CUBE_Gyver:82:9: error: ‘class GButton’ has no member named ‘setIncrStep’

butt1.setIncrStep(5); // настройка инкремента, может быть отрицательным (по умолчанию 1)

^

CUBE_Gyver:83:9: error: ‘class GButton’ has no member named ‘setIncrTimeout’

butt1.setIncrTimeout(100); // настрйока интервала инкремента (по умолчанию 800 мс)

^

CUBE_Gyver:84:9: error: ‘class GButton’ has no member named ‘setIncrStep’

butt2.setIncrStep(-5); // настройка инкремента, может быть отрицательным (по умолчанию 1)

^

CUBE_Gyver:85:9: error: ‘class GButton’ has no member named ‘setIncrTimeout’

butt2.setIncrTimeout(100); // настрйока интервала инкремента (по умолчанию 800 мс)

^

G:LEDcube-masterCUBE_GyverCUBE_Gyver.ino: In function ‘void loop()’:

CUBE_Gyver:106:13: error: ‘class GButton’ has no member named ‘isIncr’

if (butt1.isIncr()) { // если кнопка была удержана (это для инкремента)

^

CUBE_Gyver:107:23: error: ‘class GButton’ has no member named ‘getIncr’

modeTimer = butt1.getIncr(modeTimer); // увеличивать/уменьшать переменную value с шагом и интервалом

^

CUBE_Gyver:109:13: error: ‘class GButton’ has no member named ‘isIncr’

if (butt2.isIncr()) { // если кнопка была удержана (это для инкремента)

^

CUBE_Gyver:110:23: error: ‘class GButton’ has no member named ‘getIncr’

modeTimer = butt2.getIncr(modeTimer); // увеличивать/уменьшать переменную value с шагом и интервалом

^

Используем библиотеку SPI версии 1.0 из папки: C:Program Files (x86)ArduinohardwarearduinoavrlibrariesSPI
Используем библиотеку GyverButton в папке: C:Program Files (x86)ArduinolibrariesGyverButton (legacy)
exit status 1
‘class GButton’ has no member named ‘setIncrStep’

для CUBE_Gyver_v2.ino

C:Program Files (x86)ArduinolibrariesGyverHacksGyverHacks.cpp:326:1: error: prototype for ‘GTimer::GTimer(uint16_t)’ does not match any in class ‘GTimer’

GTimer::GTimer(uint16_t interval) {

^

In file included from C:Program Files (x86)ArduinolibrariesGyverHacksGyverHacks.cpp:1:0:

C:Program Files (x86)ArduinolibrariesGyverHacksGyverHacks.h:99:7: error: candidates are: constexpr GTimer::GTimer(GTimer&&)

class GTimer

^

C:Program Files (x86)ArduinolibrariesGyverHacksGyverHacks.h:99:7: error: constexpr GTimer::GTimer(const GTimer&)

C:Program Files (x86)ArduinolibrariesGyverHacksGyverHacks.h:103:2: error: GTimer::GTimer(uint32_t)

GTimer(uint32_t); // объявление таймера с указанием интервала

^

C:Program Files (x86)ArduinolibrariesGyverHacksGyverHacks.cpp:324:1: error: GTimer::GTimer()

GTimer::GTimer() {}

^

C:Program Files (x86)ArduinolibrariesGyverHacksGyverHacks.cpp:331:6: error: prototype for ‘void GTimer::setInterval(uint16_t)’ does not match any in class ‘GTimer’

void GTimer::setInterval(uint16_t interval) {

^

In file included from C:Program Files (x86)ArduinolibrariesGyverHacksGyverHacks.cpp:1:0:

C:Program Files (x86)ArduinolibrariesGyverHacksGyverHacks.h:104:7: error: candidate is: void GTimer::setInterval(uint32_t)

void setInterval(uint32_t); // установка интервала

^

Используем библиотеку SPI версии 1.0 из папки: C:Program Files (x86)ArduinohardwarearduinoavrlibrariesSPI
Используем библиотеку GyverButton в папке: C:Program Files (x86)ArduinolibrariesGyverButton (legacy)
Используем библиотеку GyverHacks в папке: C:Program Files (x86)ArduinolibrariesGyverHacks (legacy)
Используем библиотеку GyverTimer в папке: C:Program Files (x86)ArduinolibrariesGyverTimer (legacy)
Используем библиотеку EEPROM версии 2.0 из папки: C:Program Files (x86)ArduinohardwarearduinoavrlibrariesEEPROM
exit status 1
Ошибка компиляции для платы Arduino Nano.

p.s тапками не кидайте, опыт с ардуино первый. В имеющейся инфе не нашел ответа.

Александр Симонов


  • #6

Спасибо, помогло.

Взял все три библиотеки оттуда (GyverButton, GyverHacks, GyverTimer).

p.s. а для CUBE_Gyver.ino запихать в одноименную папку .h и .cpp файл библиотеки GyverButton из архива со скетчами (со свежей версией скетч в ошибке).

Изменено: 5 Фев 2019

  • #7

Доброго дня. ничего не могу сделать. При компиляции выдает ошибку
exit status 1
‘GButton’ does not name a type
и подсвечена 38 строчка скетча.
GButton touch(BTN_PIN, LOW_PULL, NORM_OPEN);
Все делал по инструкции.
Может кто-то сталкивался с такой траблой?
и 70 строка
GButton touch(BTN_PIN, LOW_PULL, NORM_OPEN);

ошибка
exit status 1
‘LOW_PULL’ was not declared in this scope

Изменено: 10 Мар 2019

Александр Симонов


  • #8

Библиотека GyverButton не установлена

  • #9

Разобрался сам. в настройках Arduino IDE библиотека бралась не та, которая шла с проектом. Решение — удалил не нужную и ошибка пропала.
Спасибо!

  • #10

Создала проект, сейчас компилятор выводит ошибку. Помогите пожалуйста с этой проблемой, я новенькая в этом деле..

Вот:
In function ‘global constructors keyed to 65535_0_sketch_mar14a.ino.cpp.o’:

lto1.exe: internal compiler error: Segmentation fault

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.

lto-wrapper.exe: fatal error: C:Program FilesWindowsAppsArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtthardwaretoolsavr/bin/avr-gcc returned 1 exit status

compilation terminated.

c:/program files/windowsapps/arduinollc.arduinoide_1.8.19.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

exit status 1
Ошибка компиляции для платы Arduino/Genuino Uno.

Александр Симонов


Александр Симонов


  • #12

Ответ, оказывается, есть в гугле. Проблема именно в баге компилятора. Для решения:
1. установить последнюю версию Arduino IDE
2. В меню «Инструменты — Плата — Менеджер плат» найти Arduino AVR Boards, выбрать версию 1.6.21 и установить её.
1552649944200.png

be3um4wka


  • #13

Здравствуйте. Помогите пожалуйста! Хотел собрать в первый раз что-то на ардуино, решил сделать bluetooth матрицу с часами, но на плату не ставится код. Места хватает и драва под плату установил, проблема в чём-то другом. Заранее спасибо…
P.S. Плата не оригинальная. Заказывал с али. Её название: WAVGAT UNO R3.

Александр Симонов


  • #14

Какую конкретно ошибку выдает Arduino IDE при загрузке скетча?

be3um4wka


  • #15

Какую конкретно ошибку выдает Arduino IDE при загрузке скетча?

Ошибка конфигурации платы WAVGAT UNO R3

  • #16

Столкнулся с проблемой при компиляции версии 1.3 в плату (лог во вложении)
Версии 1.1 и 1.2 заливаются без проблем.
Версия софта 1.8.9
Плата Arduino Nano (из ссылки под видео).
В настройках выбираю чип: ATMega328 Старый загрузчик (пробовал и все остальные), плату: Arduino Nano
Пробовал отрубать библиотеки стандартные и брать только из папки с проектом (кроме FastLED-stm32patch — её в версию 1.3 не включено)

В версии 1.3 ошибка fillAll что конкретно правилось? по поиску исправлений не нашёл.

  • 2.9 KB
    Просмотры: 20

pavel lolkek


  • #17

Доброго времяни суток . Можете помочь не могу загрузить прошивку вылазиет такая ошибка :
Arduino: 1.6.5 (Windows 7), Плата»Arduino Nano, ATmega328″

colorMusic_v2.9.ino:195:50: fatal error: FHT.h: No such file or directory
compilation terminated.
Ошибка компиляции.

pavel lolkek


  • #19

прочитал . выбираю архив и выходит это :

Выбранная папка/zip файл не содержит корректных библиотек
Неверная библиотека найдена в C:UsersuserDocumentsArduinolibrariesColorMusic-master: нет заголовочных файлов (.h), найденных в C:UsersuserDocumentsArduinolibrariesColorMusic-master

  • #20

Здравствуйте не могу загрузить скетч в ардуино выдает такую ошибку
(Ошибка компиляции для платы Arduino Nano.
Неверная библиотека найдена в C:Program Files (x86)ArduinolibrariesDHT: нет заголовочных файлов (.h), найденных в C:Program Files (x86)ArduinolibrariesDHT
Неверная библиотека найдена в C:UsersuserDocumentsArduinolibrariessketch_nov30a: нет заголовочных файлов (.h), найденных в C:UsersuserDocumentsArduinolibrariessketch_nov30a) помогите кто чем может. С уважением ко Всем.

  • #21

@Максим3704, либо не та библиотека для датчика температуры. Либо не там лежит. У меня лежит в папке /мои документы /arduino ide /libraries

Библиотеки отличаются для одних и тех же датчиков. Сам перебрал кучу, пока нашёл нужную

be3um4wka


  • #22

Какую конкретно ошибку выдает Arduino IDE при загрузке скетча?

Arduino: 1.8.9 (Windows 10), Плата:"WAVGAT UNO R3"
Внимание: platform.txt из ядра 'Arduino AVR Boards' содержит устаревшие recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}", автоматически преобразовано в recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}". Ожидайте обновления ядра.
In file included from C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/platforms/avr/fastled_avr.h:6:0,
                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/platforms.h:27,
                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/FastLED.h:55,
                 from C:GyverMatrixOS_v1.11GyverMatrixOS_v1.11.ino:137:
C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/platforms/avr/clockless_trinket.h:74:0: warning: "D1" redefined
#define D1(ADJ) DINT(T1,ADJ)
^
In file included from C:Program Files (x86)ArduinohardwareWAVavrvariantslgt8fx8p/pins_arduino.h:36:0,
                 from C:Program Files (x86)ArduinohardwareWAVavrcoreslgt8f/Arduino.h:225,
                 from sketchGyverMatrixOS_v1.11.ino.cpp:1:
c:program files (x86)arduinohardwarewavavrvariantsstandardpins_arduino.h:82:0: note: this is the location of the previous definition
#define D1 1 /* PD1 */
^
In file included from C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/platforms/avr/fastled_avr.h:6:0,
                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/platforms.h:27,
                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/FastLED.h:55,
                 from C:GyverMatrixOS_v1.11GyverMatrixOS_v1.11.ino:137:

C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/platforms/avr/clockless_trinket.h:75:0: warning: "D2" redefined

#define D2(ADJ) DINT(T2,ADJ)

^

In file included from C:Program Files (x86)ArduinohardwareWAVavrvariantslgt8fx8p/pins_arduino.h:36:0,

                 from C:Program Files (x86)ArduinohardwareWAVavrcoreslgt8f/Arduino.h:225,

                 from sketchGyverMatrixOS_v1.11.ino.cpp:1:

c:program files (x86)arduinohardwarewavavrvariantsstandardpins_arduino.h:83:0: note: this is the location of the previous definition

#define D2 2 /* PD2 */

^

In file included from C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/platforms/avr/fastled_avr.h:6:0,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/platforms.h:27,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/FastLED.h:55,

                 from C:GyverMatrixOS_v1.11GyverMatrixOS_v1.11.ino:137:

C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/platforms/avr/clockless_trinket.h:76:0: warning: "D3" redefined

#define D3(ADJ) DINT(T3,ADJ)

^

In file included from C:Program Files (x86)ArduinohardwareWAVavrvariantslgt8fx8p/pins_arduino.h:36:0,

                 from C:Program Files (x86)ArduinohardwareWAVavrcoreslgt8f/Arduino.h:225,

                 from sketchGyverMatrixOS_v1.11.ino.cpp:1:

c:program files (x86)arduinohardwarewavavrvariantsstandardpins_arduino.h:84:0: note: this is the location of the previous definition

#define D3 3 /* PD3 */

^

In file included from C:GyverMatrixOS_v1.11GyverMatrixOS_v1.11.ino:137:0:

C:Program Files (x86)ArduinolibrariesFastLED-stm32patch/FastLED.h:17:21: note: #pragma message: FastLED version 3.002.000

#    pragma message "FastLED version 3.002.000"

                     ^

In file included from C:GyverMatrixOS_v1.11GyverMatrixOS_v1.11.ino:171:0:

sketchtimerMinim.h:10:23: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11

     uint32_t _timer = 0;

                       ^

sketchtimerMinim.h:11:26: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11

     uint32_t _interval = 0;

                          ^

C:GyverMatrixOS_v1.11g_tetris.ino:13:20: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11

uint32_t colors[6] {0x0000EE, 0xEE0000, 0x00EE00, 0x00EEEE, 0xEE00EE, 0xEEEE00};

                    ^

In file included from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchplatforms/avr/fastled_avr.h:6:0,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchplatforms.h:27,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.h:55,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.cpp:2:

C:Program Files (x86)ArduinolibrariesFastLED-stm32patchplatforms/avr/clockless_trinket.h:74:0: warning: "D1" redefined

#define D1(ADJ) DINT(T1,ADJ)

^

In file included from C:Program Files (x86)ArduinohardwareWAVavrvariantslgt8fx8p/pins_arduino.h:36:0,

                 from C:Program Files (x86)ArduinohardwareWAVavrcoreslgt8f/Arduino.h:225,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchled_sysdefs.h:38,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.h:44,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.cpp:2:

c:program files (x86)arduinohardwarewavavrvariantsstandardpins_arduino.h:82:0: note: this is the location of the previous definition

#define D1 1 /* PD1 */

^

In file included from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchplatforms/avr/fastled_avr.h:6:0,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchplatforms.h:27,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.h:55,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.cpp:2:

C:Program Files (x86)ArduinolibrariesFastLED-stm32patchplatforms/avr/clockless_trinket.h:75:0: warning: "D2" redefined

#define D2(ADJ) DINT(T2,ADJ)

^

In file included from C:Program Files (x86)ArduinohardwareWAVavrvariantslgt8fx8p/pins_arduino.h:36:0,

                 from C:Program Files (x86)ArduinohardwareWAVavrcoreslgt8f/Arduino.h:225,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchled_sysdefs.h:38,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.h:44,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.cpp:2:

c:program files (x86)arduinohardwarewavavrvariantsstandardpins_arduino.h:83:0: note: this is the location of the previous definition

#define D2 2 /* PD2 */

^

In file included from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchplatforms/avr/fastled_avr.h:6:0,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchplatforms.h:27,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.h:55,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.cpp:2:

C:Program Files (x86)ArduinolibrariesFastLED-stm32patchplatforms/avr/clockless_trinket.h:76:0: warning: "D3" redefined

#define D3(ADJ) DINT(T3,ADJ)

^

In file included from C:Program Files (x86)ArduinohardwareWAVavrvariantslgt8fx8p/pins_arduino.h:36:0,

                 from C:Program Files (x86)ArduinohardwareWAVavrcoreslgt8f/Arduino.h:225,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchled_sysdefs.h:38,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.h:44,

                 from C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.cpp:2:

c:program files (x86)arduinohardwarewavavrvariantsstandardpins_arduino.h:84:0: note: this is the location of the previous definition

#define D3 3 /* PD3 */

^

C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.cpp: In member function 'void CFastLED::delay(long unsigned int)':

C:Program Files (x86)ArduinolibrariesFastLED-stm32patchFastLED.cpp:132:9: error: 'yield' was not declared in this scope

   yield();

         ^

exit status 1

Ошибка компиляции для платы WAVGAT UNO R3.



Этот отчёт будет иметь больше информации с

включенной опцией Файл -> Настройки ->

"Показать подробный вывод во время компиляции"

Изменено: 16 Апр 2019

Wan-Derer


  • #23

@be3um4wka, Дай ссылку на свою плату или сделай фото, крупно чтобы читались все надписи на микросхемах

  • #24

Чтото не заработал полив, собрал все по схеме, вкл через малый промежуток времени, ставил на часа два, три и нивкакую. похоже библиотека всему виной наверно не туда сохранил или еще что, выбивало ошибку Неверная библиотека найдена в C:Program Files (x86)Arduinolibrarieslibraries: нет заголовочных файлов (.h), найденных в C:Program Files (x86)

  • #25

Arduino: 1.6.5 (Windows 7), Плата»Arduino Nano, ATmega328″

In file included from colorMusic_v2.7_Effect_Mic_and_Line.ino:236:0:
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRLremote.h:29:2: error: #error IRLremote requires Arduino IDE 1.6.6 or greater. Please update your IDE.
#error IRLremote requires Arduino IDE 1.6.6 or greater. Please update your IDE.
^
In file included from colorMusic_v2.7_Effect_Mic_and_Line.ino:227:0:
C:Program Files (x86)ArduinolibrariesFastLED-master/FastLED.h:17:21: note: #pragma message: FastLED version 3.001.008
# pragma message «FastLED version 3.001.008»
^
In file included from C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Nec.h:28:0,
from C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRLremote.h:44,
from colorMusic_v2.7_Effect_Mic_and_Line.ino:236:
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Time.h: In member function ‘uint32_t CIRL_Time<T>::nextEvent()’:
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Time.h:135:10: error: ‘time’ does not name a type
auto time = timeout();
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Time.h:136:10: error: ‘timespan’ does not name a type
auto timespan = static_cast<T*>(this)->timespanEvent;
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Time.h:138:8: error: ‘time’ was not declared in this scope
if(time >= timespan) {
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Time.h:138:16: error: ‘timespan’ was not declared in this scope
if(time >= timespan) {
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Time.h:142:12: error: ‘timespan’ was not declared in this scope
return timespan — time;
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Time.h:142:23: error: ‘time’ was not declared in this scope
return timespan — time;
^
In file included from C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Nec.h:30:0,
from C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRLremote.h:44,
from colorMusic_v2.7_Effect_Mic_and_Line.ino:236:
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Decode.h: In static member function ‘static void CIRL_DecodeSpaces<T, blocks>::interrupt()’:
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Decode.h:100:10: error: ‘duration’ does not name a type
auto duration = T::nextTime();
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Decode.h:103:9: error: ‘duration’ was not declared in this scope
if (duration >= T::limitTimeout) {
^
In file included from C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRLremote.h:45:0,
from colorMusic_v2.7_Effect_Mic_and_Line.ino:236:
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_NecAPI.h: In member function ‘void CNecAPI<callback, address>::read()’:
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_NecAPI.h:72:8: error: ‘data’ does not name a type
auto data = CNec::read();
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_NecAPI.h:75:28: error: request for member ‘address’ in ‘CIRL_DecodeSpaces<CNec, 4>::data’, which is of non-class type ‘uint8_t [4] {aka unsigned char [4]}’
bool firstCommand = data.address != 0xFFFF;
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_NecAPI.h:76:13: error: request for member ‘address’ in ‘CIRL_DecodeSpaces<CNec, 4>::data’, which is of non-class type ‘uint8_t [4] {aka unsigned char [4]}’
if ((data.address == 0) || (address && firstCommand && (data.address != address)))
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_NecAPI.h:76:64: error: request for member ‘address’ in ‘CIRL_DecodeSpaces<CNec, 4>::data’, which is of non-class type ‘uint8_t [4] {aka unsigned char [4]}’
if ((data.address == 0) || (address && firstCommand && (data.address != address)))
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_NecAPI.h:96:14: error: request for member ‘command’ in ‘CIRL_DecodeSpaces<CNec, 4>::data’, which is of non-class type ‘uint8_t [4] {aka unsigned char [4]}’
if (data.command == lastCommand)
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_NecAPI.h:124:24: error: request for member ‘command’ in ‘CIRL_DecodeSpaces<CNec, 4>::data’, which is of non-class type ‘uint8_t [4] {aka unsigned char [4]}’
lastCommand = data.command;
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_NecAPI.h: In member function ‘uint32_t CNecAPI<callback, address>::nextTimeout()’:
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_NecAPI.h:205:10: error: ‘time’ does not name a type
auto time = timeout();
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_NecAPI.h:206:10: error: ‘timeout’ does not name a type
auto timeout = getTimeout();
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_NecAPI.h:208:8: error: ‘time’ was not declared in this scope
if(time >= timeout) {
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_NecAPI.h:212:22: error: ‘time’ was not declared in this scope
return timeout — time;
^
In file included from C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRLremote.h:47:0,
from colorMusic_v2.7_Effect_Mic_and_Line.ino:236:
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Hash.h: In static member function ‘static void CHashIR::interrupt()’:
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Hash.h:180:10: error: ‘duration’ does not name a type
auto duration = nextTime();
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Hash.h:183:8: error: ‘duration’ was not declared in this scope
if(duration >= HASHIR_TIMEOUT)
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Hash.h:213:18: error: ‘oldval’ does not name a type
auto oldval = lastDuration;
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Hash.h:214:18: error: ‘newval’ does not name a type
auto newval = duration;
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Hash.h:220:17: error: ‘newval’ was not declared in this scope
if (newval < (oldval * 3 / 4)) {
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Hash.h:220:27: error: ‘oldval’ was not declared in this scope
if (newval < (oldval * 3 / 4)) {
^
C:Program Files (x86)ArduinolibrariesIRLremote-mastersrc/IRL_Hash.h:240:28: error: ‘duration’ was not declared in this scope
lastDuration = duration;
^
colorMusic_v2.7_Effect_Mic_and_Line.ino: In function ‘void remoteTick()’:
colorMusic_v2.7_Effect_Mic_and_Line:848: error: ‘data’ does not name a type
colorMusic_v2.7_Effect_Mic_and_Line:849: error: ‘data’ was not declared in this scope
‘data’ does not name a type

WARNING: Spurious .github folder in ‘Adafruit NeoPixel’ library

WARNING: Spurious .github folder in ‘Adafruit NeoPixel’ library

Это сообщение будет содержать больше информации чем
«Отображать вывод во время компиляции»
включено в Файл > Настройки

@leonardo

i tried modifying the codes you’ve posted as follows

Code: Select all

int32_t channel_1_start, channel_1_stop, channel_1;
void handler_channel_1(void);

void handler_channel_1(void) {
  if (0b1 & GPIOA->IDR) {
    channel_1_start = TIM2->CCR1;
    TIM2->CCER |= TIM_CCER_CC1P;
  }
  else {
    channel_1 = TIM2->CCR1 - channel_1_start;
    if (channel_1 < 0)channel_1 += 0xFFFF;
    TIM2->CCER &= ~TIM_CCER_CC1P;
  }
}

HardwareTimer *pTimer2 = new HardwareTimer(TIM2);

void setup() {
  Serial.begin(57600);
  pinMode(PA0, INPUT);
  delay(250);

  pTimer2->attachInterrupt(1, handler_channel_1);
  //Timer2.attachCompare1Interrupt(handler_channel_1);
  TIM2->CR1 = TIM_CR1_CEN;
  TIM2->CR2 = 0;
  TIM2->SMCR = 0;
  TIM2->DIER = TIM_DIER_CC1IE;
  TIM2->EGR = 0;
  TIM2->CCMR1 = TIM_CCMR1_IC1PSC;
  TIM2->CCMR2 = 0;
  TIM2->CCER = TIM_CCER_CC1E;
  TIM2->PSC = 71;
  TIM2->ARR = 0xFFFF;
  TIM2->DCR = 0;
}

void loop() {
	delay(1000);
	Serial.println(channel_1);
}

the codes actually compiles but that i’m not sure if at all what it does.
the main additions are i defined

Code: Select all

HardwareTimer *pTimer2 = new HardwareTimer(TIM2);

^ note it is a pointer, not an object

then i called attach interrupt this way

Code: Select all

  pTimer2->attachInterrupt(1, handler_channel_1);

that is based on hints described in the api
https://github.com/stm32duino/wiki/wiki … er-library

but really, the codes that you have posted made many direct register access, e.g. configures the timers
i’ve not deciphered them and do not understand what they are intending to do.
to really understand your codes it would be necessary to review the reference manual
in particular chpt 17 general purpose timers, review the functionalities and features of the timers how they work.
and check that against the registers referenced to figure out what it does.
https://www.st.com/resource/en/referenc … ronics.pdf

what would be more appropriate is to review and try the examples that has been created by the authors e.g. fpistm et.al.
e.g. some short ones here
https://github.com/stm32duino/wiki/wiki … ry#3-usage
then many more here
https://github.com/stm32duino/wiki/wiki … 4-examples
https://github.com/stm32duino/STM32Examples
https://github.com/stm32duino/STM32Exam … dwareTimer

i tried this code it blinks my led. I created this reading the api docs and examples.

Code: Select all

#include <Arduino.h>
#include <HardwareTimer.h>

HardwareTimer *pTimer2 = new HardwareTimer(TIM2);

void blink() {
	digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}

void setup() {
	uint8_t channel = 1;
	pTimer2->pause(); // pause the timer
	pTimer2->setMode(channel, TIMER_OUTPUT_COMPARE); //output compare mode, got this from reading the api notes
	pTimer2->setOverflow(500000, MICROSEC_FORMAT); // blink my led every 0.5 sec
	pTimer2->attachInterrupt(blink); // attach the blink handler
	pTimer2->refresh(); //reset the counters
	pTimer2->resume(); //start the timer
}

void loop() {
	delay(1000);
}

note that loop() here does nothing. that delay(1000) statement can be deleted and the led still blinks

note that i’ve been messing with libmaple core, so official stm core is just as ‘new’ to me as anyone.
it takes time to learn all these and keep the manual handy and review the manual especially about the hardware timers.
that will help you understand the actual hardware features offered by the timers and review the examples and api and try them out.
the api is to a large extent somehow related to the (timer) hardware features, hence reading both the manual and the api and trying
the examples would actually help. some of the api features i’d guess are ‘in development’ so it may after all ‘grow’ over time to encompass
more features available on stm32.

the board i used is stm32f401ccu black pill, rather common to find on aliexpress, ebay etc these days
https://stm32-base.org/boards/STM32F401 … -Pill-V1.2

stm32’s timers are pretty advanced (lots of complicated, small and large features). a main use i commonly used them for
is just like my code above, i.e. call back my isr handler, function. then quite a lot of things can be done from within the isr call.
just that doing it this way has very high overheads. normally, it may not even go above 1 mhz for that isr calls with all the codes
done in the isr handler. other more advanced uses of timers is that they can initiate dma, linked with adc etc.
and they do pwm. it takes quite a few settings to setup, but once done the pulse train is generated by hardware, the cpu can process other stuff.

Понравилась статья? Поделить с друзьями:
  • Error time trio theme
  • Error tiles gif is missing or corrupted the escapists
  • Error thrown whilst accessing jei internals
  • Error thrown cannot create references to from string offsets
  • Error thrown call to undefined function eregi