Помогите со скетчем

dj-toxa
Offline
Зарегистрирован: 06.04.2016

Помогите со скетчем из проекта http://instructables.info/bolshie-nastennyie-chasyi-na-arduino/ у автора он судя по всему работал, а у меня не хочет компилиться и шиться в мою Arduino Nano(CH340) выдает exit status 1 no matching function for call to ‘CFastLED::addLeds(CRGB [29], int)’ вот сам скетч

#include "FastLED.h"

// How many leds in your strip?
#define NUM_LEDS 29 

// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN.  For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 6
#define CLOCK_PIN 13

// Define the array of leds
CRGB leds[NUM_LEDS];

void setup() { 
  Serial.begin(57600);
  Serial.println("resetting");
  LEDS.addLeds<NEOPIXEL,2,RGB>(leds,NUM_LEDS);
  LEDS.setBrightness(84);
}

void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } }

void loop() { 
  static uint8_t hue = 0;
  Serial.print("x");
  // First slide the led in one direction
  for(int i = 0; i < NUM_LEDS; i++) {
    // Set the i'th led to red 
    leds[i] = CHSV(hue++, 255, 255);
    // Show the leds
    FastLED.show(); 
    // now that we've shown the leds, reset the i'th led to black
    // leds[i] = CRGB::Black;
    fadeall();
    // Wait a little bit before we loop around and do it again
    delay(10);
  }
  Serial.print("x");

  // Now go in the other direction.  
  for(int i = (NUM_LEDS)-1; i >= 0; i--) {
    // Set the i'th led to red 
    leds[i] = CHSV(hue++, 255, 255);
    // Show the leds
    FastLED.show();
    // now that we've shown the leds, reset the i'th led to black
    // leds[i] = CRGB::Black;
    fadeall();
    // Wait a little bit before we loop around and do it again
    delay(10);
  }
}

запара начинается со строки CRGB leds[NUM_LEDS];

 

dj-toxa
Offline
Зарегистрирован: 06.04.2016

и какие библиатеки кроме часов реального времени, и фастлед еще потребуются для финального скетча

#include <DS3232RTC.h>
#include <Time.h> 
#include <Wire.h> 
#include "FastLED.h"
#define NUM_LEDS 29 // Number of LED controles (remember I have 3 leds / controler
#define COLOR_ORDER BRG  // Define color order for your strip
#define DATA_PIN 6  // Data pin for led comunication

CRGB leds[NUM_LEDS]; // Define LEDs strip
byte digits[10][7] = {{0,1,1,1,1,1,1},  // Digit 0
                     {0,1,0,0,0,0,1},   // Digit 1
                     {1,1,1,0,1,1,0},   // Digit 2
                     {1,1,1,0,0,1,1},   // Digit 3
                     {1,1,0,1,0,0,1},   // Digit 4
                     {1,0,1,1,0,1,1},   // Digit 5
                     {1,0,1,1,1,1,1},   // Digit 6
                     {0,1,1,0,0,0,1},   // Digit 7
                     {1,1,1,1,1,1,1},   // Digit 8
                     {1,1,1,1,0,1,1}};  // Digit 9 | 2D Array for numbers on 7 segment
bool Dot = true;  //Dot state
bool DST = false; //DST state
int ledColor = 0x0000FF; // Color used (in hex)
void setup(){ 
//  Serial.begin(9600); 
//  Wire.begin(); 
  LEDS.addLeds<WS2811, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS); // Set LED strip type
  LEDS.setBrightness(255); // Set initial brightness
  pinMode(2, INPUT_PULLUP); // Define DST adjust button pin
  pinMode(4, INPUT_PULLUP); // Define Minutes adjust button pin
  pinMode(5, INPUT_PULLUP); // Define Hours adjust button pin
} 
// Get time in a single number, if hours will be a single digit then time will be displayed 155 instead of 0155
int GetTime(){
  tmElements_t Now;
  RTC.read(Now);
  //time_t Now = RTC.Now();// Getting the current Time and storing it into a DateTime object 
  int hour=Now.Hour;
  int minutes=Now.Minute;
  int second =Now.Second;
  if (second % 2==0) {Dot = false;}
    else {Dot = true;};
  return (hour*100+minutes);
  };

// Check Light sensor and set brightness accordingly
void BrightnessCheck(){
  const byte sensorPin = 3; // light sensor pin
  const byte brightnessLow = 5; // Low brightness value
  const byte brightnessHigh = 255; // High brightness value
  int sensorValue = digitalRead(sensorPin); // Read sensor
  if (sensorValue == 0) {LEDS.setBrightness(brightnessHigh);}
  else {LEDS.setBrightness(brightnessLow);}  
  };
  
// Convert time to array needet for display 
void TimeToArray(){
  int Now = GetTime();  // Get time
  int cursor = 29;
  
//  Serial.print("Time is: ");Serial.println(Now);
  if (DST){   // if DST is true then add one hour
   Now+=100;
//   Serial.print("DST is ON, time set to : ");Serial.println(Now);
  }; 
  if (Dot){leds[14]=ledColor;}
    else {leds[14]=0x000000;
    };
  for(int i=1;i<=4;i++){
    int digit = Now % 10; // get last digit in time
    if (i==1){
//      Serial.print("Digit 4 is : ");Serial.print(digit);Serial.print(" ");
      cursor =22;
      for(int k=0; k<=6;k++){ 
//        Serial.print(digits[digit][k]);
        if (digits[digit][k]== 1){leds[cursor]=ledColor;}
         else if (digits[digit][k]==0){leds[cursor]=0x000000;};
         cursor ++;
        };
//      Serial.println();
      }
    else if (i==2){
//      Serial.print("Digit 3 is : ");Serial.print(digit);Serial.print(" ");
      cursor -=14;
      for(int k=0; k<=6;k++){ 
//        Serial.print(digits[digit][k]);
        if (digits[digit][k]== 1){leds[cursor]=ledColor;}
         else if (digits[digit][k]==0){leds[cursor]=0x000000;};
         cursor ++;
        };
//      Serial.println();
      }
    else if (i==3){
//      Serial.print("Digit 2 is : ");Serial.print(digit);Serial.print(" ");
      cursor =7;
      for(int k=0; k<=6;k++){ 
//        Serial.print(digits[digit][k]);
        if (digits[digit][k]== 1){leds[cursor]=ledColor;}
         else if (digits[digit][k]==0){leds[cursor]=0x000000;};
         cursor ++;
        };
//      Serial.println();
      }
    else if (i==4){
//      Serial.print("Digit1 is : ");Serial.print(digit);Serial.print(" ");
      cursor =0;
      for(int k=0; k<=6;k++){ 
//        Serial.print(digits[digit][k]);
        if (digits[digit][k]== 1){leds[cursor]=ledColor;}
         else if (digits[digit][k]==0){leds[cursor]=0x000000;};
         cursor ++;
        };
//      Serial.println();
      }
    Now /= 10;
  }; 
};
void DSTcheck(){
   int buttonDST = digitalRead(2);
//   Serial.print("DST is: ");Serial.println(DST);
   if (buttonDST == LOW){
    if (DST){
      DST=false;
//      Serial.print("Switching DST to: ");Serial.println(DST);
      }
      else if (!DST){
        DST=true;
//        Serial.print("Switching DST to: ");Serial.println(DST);
      };
   delay(500);   
   };
  }

void TimeAdjust(){
  int buttonH = digitalRead(5);
  int buttonM = digitalRead(4);
  if (buttonH == LOW || buttonM == LOW){
    delay(500);
    tmElements_t Now;
    RTC.read(Now);
    int hour=Now.Hour;
    int minutes=Now.Minute;
    int second =Now.Second;
      if (buttonH == LOW){
        if (Now.Hour== 23){Now.Hour=0;}
          else {Now.Hour += 1;};
        }else {
          if (Now.Minute== 59){Now.Minute=0;}
          else {Now.Minute += 1;};
          };
    RTC.write(Now); 
    }
  }
void loop()  // Main loop
{ 
  BrightnessCheck(); // Check brightness
  DSTcheck(); // Check DST
  TimeAdjust(); // Check to se if time is geting modified
  TimeToArray(); // Get leds array with required configuration
  FastLED.show(); // Display leds array
}

 

ЕвгенийП
ЕвгенийП аватар
Offline
Зарегистрирован: 25.05.2015

А FastLED.h можно глянуть?

dj-toxa
Offline
Зарегистрирован: 06.04.2016

В каком смысле глянуть? Библиотеку которую использовал выложить? Вот https://yadi.sk/d/nuDjOZvJqnUGc

ЕвгенийП
ЕвгенийП аватар
Offline
Зарегистрирован: 25.05.2015

Ага, ну, понятно. Посмотрите на строку 172 в файле FastLED.h - там же описана функция addLeds и совсем не так, как Вы её пытаетесь вызывать.

Попробуйте в строке 18 (у себя - скетч из первого поста)  заменить 

LEDS.addLeds<NEOPIXEL,2,RGB>(leds,NUM_LEDS);

на 

LEDS.addLeds<NEOPIXEL,2,RGB>(&(leds[0]),NUM_LEDS);

По крайней мере эта ошибка должна уйти.

dj-toxa
Offline
Зарегистрирован: 06.04.2016

Что то не выходит опять ошибка компиляции

F3K16XPIGJOSNA5.ino: In function 'void setup()':
F3K16XPIGJOSNA5.ino:18:51: error: no matching function for call to 'CFastLED::addLeds(CRGB*, int)'
F3K16XPIGJOSNA5.ino:18:51: note: candidates are:
In file included from F3K16XPIGJOSNA5.ino:1:0:
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:172:129: note: template<ESPIChipsets CHIPSET, unsigned char DATA_PIN, unsigned char CLOCK_PIN, EOrder RGB_ORDER, unsigned char SPI_DATA_RATE> CLEDController& CFastLED::addLeds(CRGB*, int, int)
  template<ESPIChipsets CHIPSET,  uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER, uint8_t SPI_DATA_RATE > CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
                                                                                                                                 ^
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:172:129: note:   template argument deduction/substitution failed:
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:184:95: note: template<ESPIChipsets CHIPSET, unsigned char DATA_PIN, unsigned char CLOCK_PIN> static CLEDController& CFastLED::addLeds(CRGB*, int, int)
  template<ESPIChipsets CHIPSET,  uint8_t DATA_PIN, uint8_t CLOCK_PIN > static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
                                                                                               ^
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:184:95: note:   template argument deduction/substitution failed:
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:196:113: note: template<ESPIChipsets CHIPSET, unsigned char DATA_PIN, unsigned char CLOCK_PIN, EOrder RGB_ORDER> static CLEDController& CFastLED::addLeds(CRGB*, int, int)
  template<ESPIChipsets CHIPSET,  uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER > static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
                                                                                                                 ^
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:196:113: note:   template argument deduction/substitution failed:
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:209:56: note: template<ESPIChipsets CHIPSET> static CLEDController& CFastLED::addLeds(CRGB*, int, int)
  template<ESPIChipsets CHIPSET> static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
                                                        ^
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:209:56: note:   template argument deduction/substitution failed:
F3K16XPIGJOSNA5.ino:18:51: error: wrong number of template arguments (3, should be 1)
In file included from F3K16XPIGJOSNA5.ino:1:0:
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:213:74: note: template<ESPIChipsets CHIPSET, EOrder RGB_ORDER> static CLEDController& CFastLED::addLeds(CRGB*, int, int)
  template<ESPIChipsets CHIPSET, EOrder RGB_ORDER> static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
                                                                          ^
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:213:74: note:   template argument deduction/substitution failed:
F3K16XPIGJOSNA5.ino:18:51: error: wrong number of template arguments (3, should be 2)
In file included from F3K16XPIGJOSNA5.ino:1:0:
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:217:97: note: template<ESPIChipsets CHIPSET, EOrder RGB_ORDER, unsigned char SPI_DATA_RATE> static CLEDController& CFastLED::addLeds(CRGB*, int, int)
  template<ESPIChipsets CHIPSET, EOrder RGB_ORDER, uint8_t SPI_DATA_RATE> static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
                                                                                                 ^
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:217:97: note:   template argument deduction/substitution failed:
F3K16XPIGJOSNA5.ino:18:51: error: invalid conversion from 'int' to 'EOrder' [-fpermissive]
In file included from F3K16XPIGJOSNA5.ino:1:0:
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:244:25: note: template<template<unsigned char DATA_PIN, EOrder RGB_ORDER> class CHIPSET, unsigned char DATA_PIN, EOrder RGB_ORDER> static CLEDController& CFastLED::addLeds(CRGB*, int, int)
  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
                         ^
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:244:25: note:   template argument deduction/substitution failed:
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:250:25: note: template<template<unsigned char DATA_PIN, EOrder RGB_ORDER> class CHIPSET, unsigned char DATA_PIN> static CLEDController& CFastLED::addLeds(CRGB*, int, int)
  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
                         ^
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:250:25: note:   template argument deduction/substitution failed:
F3K16XPIGJOSNA5.ino:18:51: error: wrong number of template arguments (3, should be 2)
In file included from F3K16XPIGJOSNA5.ino:1:0:
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:256:25: note: template<template<unsigned char DATA_PIN> class CHIPSET, unsigned char DATA_PIN> static CLEDController& CFastLED::addLeds(CRGB*, int, int)
  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
                         ^
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:256:25: note:   template argument deduction/substitution failed:
F3K16XPIGJOSNA5.ino:18:51: error: wrong number of template arguments (3, should be 2)
In file included from F3K16XPIGJOSNA5.ino:1:0:
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:292:25: note: template<template<EOrder RGB_ORDER> class CHIPSET, EOrder RGB_ORDER> static CLEDController& CFastLED::addLeds(CRGB*, int, int)
  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
                         ^
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:292:25: note:   template argument deduction/substitution failed:
F3K16XPIGJOSNA5.ino:18:51: error: wrong number of template arguments (3, should be 2)
In file included from F3K16XPIGJOSNA5.ino:1:0:
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:298:25: note: template<template<EOrder RGB_ORDER> class CHIPSET> static CLEDController& CFastLED::addLeds(CRGB*, int, int)
  static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
                         ^
C:\Users\Dj-Toxa\Documents\Arduino\libraries\FastLED/FastLED.h:298:25: note:   template argument deduction/substitution failed:
F3K16XPIGJOSNA5.ino:18:51: error: wrong number of template arguments (3, should be 1)
Ошибка компиляции.

 

dj-toxa
Offline
Зарегистрирован: 06.04.2016

А куда правильнее кидать библиотеку в libraries в папке с программой или в C:\Users\Вася\Documents\Arduino\libraries. Или без разницы? Да и первый скетч не столь важен он лишь для проверки, зажеч все табло. А вот как бы второй заставить компилиться?

dj-toxa
Offline
Зарегистрирован: 06.04.2016

на второй скетч http://www.instructables.com/files/orig/FLT/K1MP/IGJOSU6N/FLTK1MPIGJOSU6N.ino с вот этим софтом https://www.arduino.cc/download_handler.php?f=/arduino-1.6.8-windows.zip и библиатеками https://yadi.sk/d/xpp2hstfqonHT и https://yadi.sk/d/_zFPWVEvqonMq выдает

In file included from C:\Users\Dj-Toxa\Documents\Arduino\sketch_apr07a\sketch_apr07a.ino:1:0:

C:\Users\Dj-Toxa\Documents\Arduino\libraries\DS3232RTC/DS3232RTC.h:40:18: fatal error: Time.h: No such file or directory

 #include <Time.h>

                  ^

compilation terminated.

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

 

dj-toxa
Offline
Зарегистрирован: 06.04.2016

С версией 1.5.8 и библиотеками Time,DS3231RTC,FastLED вроде финальный скетч компилится, завтра попробую залить на работе в Ардуинку, поглядим что получится. Я то думал Time.h в DS3231RTC есть, а она как отдельная библиотека идет.