Very new to this. I have downloaded a file from GitHub and used the add zip file in ide to locate the download, which it does. I have opened the file but cannot get it to go into the library. From what I’ve read it should be in the library after I open it. I’ve tried the alternative way of dragging the file into the sketchbook location and that doesn’t work. What am I missing?
Thanks
Welcome to the forum
What exactly do you mean by this ? What where you expecting to do with the library ?
Which file? Please post a link.
The file downloads ok and I can open it, I just cannot get it in the ide sketch library. I am new to this, so am probably missing something. It appears to be a simple process
used the add zip file in ide
I assume you're talking about the "Sketch > Include Library > Add .ZIP Library..." menu item. This would be correct, however the GitHub repo you linked isn't really a library.
Installation
Click on the Clone or download button and select Download ZIP. The file will download as IoT-Kits-Firmware-master.zip.
Unzip the file. Change the name of the extracted folder to IoT-Kits.
Copy this to your Arduino sketchbook folder. If you need to find your sketchbook folder, open the Arduino IDE and use menu File | Preferences. The first line tells you where the sketchbook resides on your computer.
Following these instructions from the GitHub repo, I was able to add to the sketchbook.
The short version is: unzip and place the folder in the same place as the IDE tries to save your sketches by default.
I am still not clear which file or files you downloaded
To install a library from a zip file the process to install it and its examples would be to download the .zip created by GitHub then in the IDE use Sketch/Include Library/Add ZIP Library then select the downloaded file for installation
However, the .zip file must contain the data in a format that the IDE can understand or the installation will not succeed
Which, if any of these steps have you done ?
Which Arduino board are you using ?
Thanks everyone who tried to help me.
Here is what I’m trying to do:
I’m trying to build a WiFi weather station I saw on YouTube. It uses an esp8266 that is programmed from an arduino IDE( not using an arduino board)
I have added the esp8266 board to the IDE and programmed it from the sketchbook library in the IDE. I have opened an internet of things account, now I am trying to add the file from GitHub to add to the IDE library so I can upload that file to the esp 8266 to send weather info to my thingspeak channel.
Here is what I’ve done, downloaded the zip file from GitHub, it goes into my download file and I can open it and see the necessary files inside it. I then go to the IDE, select sketch,select include library,add zip library. This takes me to my download folder where my downloaded file is.
I have tried copy and paste to where my sketchbook is located but cannot make it work. I have tried dragging it to that folder but cannot get it to go. I’m sorry, I don’t think it should be this hard ,it seems simple but I can’t make it work. Maybe I the one who’s simple. This is not my background, just trying to learn something new that interested me in my old age. Thank you all for the help, very frustrating as I had no trouble downloading the arduino, the esp8266 board. Thank you for your time
Don't do that! It's not a library so you won't have any success if you try to install it as a library. This is a collection of Arduino sketches. So you must open the sketch just as you would do with any other sketch.
Since it seems the instructions provided in the project documentation were not very clear, I'll provide my own version of them that might be more helpful to you:
Please follow these instructions exactly as written:
-
Click the following link to download the firmware:
https://github.com/W4KRL/IoT-Kits-Firmware/archive/refs/heads/master.zip -
Wait for the download to finish.
-
Unzip the downloaded
IoT-Kits-Firmware-masterfile. -
Start Arduino IDE.
-
Select File > Open from the Arduino IDE menus.
An "Open" dialog will open. -
Navigate to the folder that was created when you unzipped the downloaded file at step (3) of these instructions.
-
You will now see there are several subfolders:
- D1M-WX1-APRS-REST
- D1M-WX1-Calibration
- D1M-WX1-IoT-REST
- D1S-Display-APRS-manual-config
- D1S-Display-IoT-manual-config
Each of these is a different sketch. Open the folder that contains the sketch you want to upload to your ESP8266 board.
-
Select the
.inofile you find in that folder. -
Click the "Open" button in the dialog.
The sketch will now open in Arduino IDE. You can edit, compile, and upload it to your ESP8266 board just as you would do with any other Arduino sketch.
Please let me know if you have any questions or problems while following those instructions.
Thank you, that worked. I used the sketch to input my info and then ran a verify to check it before uploading to the esp8266. It gave me a compilation error code of:
BME280/BME280.cpp:98:1: error: no return statement in function returning non-void (-Werror=return-type)
Sit status 1
Compilation error: no return statement in function returning non- void(-werror=return-type
I don’t know what that means or how to fix it
Sorry for my questions
You are welcome.
Please tell us the name of the sketch. As I mentioned in my previous reply, the file you downloaded contains five different sketches. We need to know which one you are compiling so we can help you to fix that error.
It means there is a bug in one of the files used by the sketch.
I would wait until later to provide you with a more detailed explanation of the cause of the error because I think for now it will be best to focus our attention on helping you to fix the bug in someone else's code.
The sub folder is:
D1M-WX1-Iot-Rest.ino
And the sketch inside that sub folder I input my info in and try to verify is:
ThinkSpeak_config.h
Hopefully this is what you need.
Thanks
OK, great. I'll provide instructions you can follow to fix the bug in the code:
- Open the "D1M-WX1-Iot-Rest" sketch in Arduino IDE.
- Select Sketch > Show Sketch Folder from the Arduino IDE menus.
TheD1M-WX1-Iot-Restfolder will open in your file manager application. - Navigate to the
src/BME280subfolder of thatD1M-WX1-Iot-Restfolder. - Open the file named
BME280.cppin any text editor. - Change line 97 of the file from this:
to this:WriteRegister(CONFIG_ADDR, config);WriteRegister(CONFIG_ADDR, config); return true; - Save the file.
- Close the text editor.
Now switch back to the Arduino IDE window and try compiling the sketch again. This time the error should no longer occur.
Since you asked, I'll go ahead and give you some explanation about this now. But please perform the instructions in my previous reply and verify the sketch is compiling first because this is only supplemental information valuable for the sake of learning, but that you don't actually need to complete the project.
The "Arduino programming language" and the C++ programming language used in Arduino sketches allows us to create things called "functions":
https://cplusplus.com/doc/tutorial/functions/
A function can return data and so we declare the type of the data returned by a function.
Sometimes we don't have any need to return data from a function. In this case we use the void data type. For example:
void sayHello() {
Serial.println("Hello world!");
}
We could have added a return statement in the function, but it was not important because we don't return any data from this function.
In functions that do return data we must use the return statement though. For example:
byte theAnswerIs() {
return 42;
}
Now consider a function that specifies a non-void return type, but doesn't return anything. For example:
byte sayHello() {
Serial.println("Hello world!");
}
It makes no sense at all that we declared that the function was going to return a byte, but it never did that. This is exactly what the author of the code in BME280.cpp did:
bool BME280::WriteSettings()
{
uint8_t ctrlHum, ctrlMeas, config;
CalculateRegisters(ctrlHum, ctrlMeas, config);
WriteRegister(CTRL_HUM_ADDR, ctrlHum);
WriteRegister(CTRL_MEAS_ADDR, ctrlMeas);
WriteRegister(CONFIG_ADDR, config);
}
The function promises to return a bool, but doesn't do that. This is why the ESP8266 compiler threw an error when it tried to compile this bad code:
The simple solution I provided in my previous reply was to simply add a return statement to make the function do what it promised. An slightly more complicated alternative fix would have been to change the return type to void:
void BME280::WriteSettings()
{
uint8_t ctrlHum, ctrlMeas, config;
CalculateRegisters(ctrlHum, ctrlMeas, config);
WriteRegister(CTRL_HUM_ADDR, ctrlHum);
WriteRegister(CTRL_MEAS_ADDR, ctrlMeas);
WriteRegister(CONFIG_ADDR, config);
}
The reason why the author of the code didn't notice the bug they made is that the compiler is configured to be more lenient about this sort of non-critical bug when you compile for other boards. For example, if you compiled this for an UNO board, you would only get a warning message about the "no return statement in function returning non-void" bug, and unfortunately many sloppy developers either have the IDE configured to not show warnings, or else simply ignore this important information from the compiler.
Something I should point out in case it is not clear is that a sketch is a folder, not a file. Although many common sketches only contain a single file, they can contain multiple files, as is the case with the "D1M-WX1-Iot-Rest" sketch. All the code files of a sketch are compiled; not only the file you happen to have selected in Arduino IDE.
Thank you so much. I did as you said and added the return true and saved. Then double checked my input info and verified it. No error codes, I then uploaded it to the esp8266 and it uploaded without errors. I read the information link you highlighted on functions( I’m so new to this, much of it was over my head, but I’m trying to learn).
Thank you so much for your help and guidance, I was ready to give up and quit. I was an instructor of circuits and schematics in the U.S.A.F.,but that was 60 years ago. Very little of that transfers to today’s electronics.
This was the first time I’ve ever “talked” on a forum or anything like it. You have made it a welcoming experience.
You are welcome. I'm glad it is working now.
Best wishes for success in your Arduino endeavors!
Per
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.