bonjour
j'aurai besoin de renseignement sur l'utilisation des bibliothèques Arduino car on trouve de tout et de rien (enfin pour moi).
je m'explique j'ai rassemble plusieurs code que j'ai commencé a mettre en œuvre mais j'ai déjà des soucis même en exécutant des exemples.
j'utilise enhanced nextion library et ça commence déjà mal.
//******************************************************************************************************************************************
//** Daylight simulator for Arduino with 2812 LED strip and DS18B20 and Nextion NX4832K011R **
//** This code is part of a project on daylight/moonlight simulation with arduino Uno R3 and Nextion **
//******************************************************************************************************************************************
#include <Nextion.h>
#include <SPI.h>
#include <Adafruit_NeoPixel.h>
#include <math.h>
#include <RTClib.h>
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#ifdef ESP8266
// esp8266 / NodeMCU software serial ports
SoftwareSerial mySerial(D2, D1); // RX, TX
#else
SoftwareSerial mySerial(3,2); // RX, TX
#endif
#define ONE_WIRE_BUS 5 //pin 5 for DS18B20
// var DS18B20
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float Celcius=0;
float Fahrenheit=0;
//Used vars
const int blocktime = 9000; //Cycles of 0.2 seconds of each color block (there are max 48 blocks) (9000 = 30 minutes)
const int amountOfLeds = 432; //The amount of 2812 LED's to be addressed 144led/M X3
SoftwareSerial NexSerial(10,11);// RX, TX on pins 10 and 11 (A5, A4) for Nextion
RTC_DS3231 rtc;
//var ds3231 rtc
char daysOfTheWeek[7][4] = {"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"};
int Day;
int Month;
int Year;
int Secs;
int Minutes;
int Hours;
String dofweek; // day of week
String myDate;
String myTime;
//var KelvinRGB
int curRed;
int curGrn;
int curBlu;
int newRed;
int newGrn;
int newBlu;
int kelvin;
int brightness;
int setWhitePointRed;
int setWhitePointGrn;
int setWhitePointBlu;
int curTime = 0;
int block = 0;
int oldRed = 0;
int oldGrn = 0;
int oldBlu = 0;
int oldKelvin = 0;
int shiftToLeft(int number);
Adafruit_NeoPixel strip = Adafruit_NeoPixel(amountOfLeds, 6, NEO_GRB + NEO_KHZ800);
// Declare objects that we are going to read from the display. This includes buttons, sliders, text boxes, etc:
// Format: <type of object> <object name> = <type of object>(<page id>, <object id>, "<object name>");
/* ***** Types of objects:
* NexButton - Button
* NexDSButton - Dual-state Button
* NexHotspot - Hotspot, that is like an invisible button
* NexCheckbox - Checkbox
* NexRadio - "Radio" checkbox, that it's exactly like the checkbox but with a rounded shape
* NexSlider - Slider
* NexGauge - Gauge
* NexProgressBar - Progress Bar
* NexText - Text box
* NexScrolltext - Scroll text box
* NexNumber - Number box
* NexVariable - Variable inside the nextion display
* NexPage - Page touch event
* NexGpio - To use the Expansion Board add-on for Enhanced Nextion displays
* NexRtc - To use the real time clock for Enhanced Nextion displays
* *****
*/
NexButton b0 = NexButton(4, 1,"b0"); // Button added
NexButton b1 = NexButton(4, 3, "b1" ); // Button added
NexVariable va33 = NexVariable(4, 5, "va33"); // Variable added so we can read it
NexVariable vah = NexVariable(4, 6, "vah"); // Variable added so we can read it
NexVariable vam = NexVariable(4, 7, "vam"); // Variable added so we can read it
NexVariable vas = NexVariable(4, 8, "vas"); // Variable added so we can read it
tout ce qui concerne nexbutton ne fonctionne pas et me donne comme message.
Compiling .pio\build\uno\libc55\Wire\utility\twi.c.o
src\main.cpp:96:35: error: no matching function for call to 'NexButton::NexButton(int, int, const char [3])'
NexButton b0 = NexButton(4, 1,"b0"); // Button added
^
In file included from .pio\libdeps\uno\Enhanced-Nextion-Library\include/Nextion.h:32:0,
from src\main.cpp:14:
.pio\libdeps\uno\Enhanced-Nextion-Library\include/NexButton.h:57:5: note: candidate: NexButton::NexButton(Nextion*, uint8_t, uint8_t, const char*, const
NexObject*)
NexButton(Nextion *nextion, uint8_t pid, uint8_t cid, const char *name, const NexObject* page=nullptr);
^~~~~~~~~
.pio\libdeps\uno\Enhanced-Nextion-Library\include/NexButton.h:57:5: note: candidate expects 5 arguments, 3 provided
.pio\libdeps\uno\Enhanced-Nextion-Library\include/NexButton.h:41:7: note: candidate: constexpr NexButton::NexButton(const NexButton&)
class NexButton: public NexTouch
^~~~~~~~~
.pio\libdeps\uno\Enhanced-Nextion-Library\include/NexButton.h:41:7: note: candidate expects 1 argument, 3 provided
.pio\libdeps\uno\Enhanced-Nextion-Library\include/NexButton.h:41:7: note: candidate: constexpr NexButton::NexButton(NexButton&&)
.pio\libdeps\uno\Enhanced-Nextion-Library\include/NexButton.h:41:7: note: candidate expects 1 argument, 3 provided
src\main.cpp:97:37: error: no matching function for call to 'NexButton::NexButton(int, int, const char [3])'
NexButton b1 = NexButton(4, 3, "b1" ); // Button added
je comprend pas comment il peut y avoir une erreur vue que le nexbutton.h est bien dans la library.
edit: j'utilise vscode avec platformio