Hi,
I'm creating a project and I need to use a library that is not on the Arudino Library List. It's a library that I found on GitHub and it's written in C++. It's possible to import this library into my arduino project so i can use it? If so, how can I do it? The library is called freeopcua.
Thanks in advance.
You copy the entire directory containing the library files and and any examples to the Arduino folder that contains the directory “libraries”.
On a 1 to 10 scale of difficulty to implement, it’s a zero. Just remember to restart the ide after copying the files.
WattsThat:
On a 1 to 10 scale of difficulty to implement, it’s a zero. Just remember to restart the ide after copying the files.
Ummmmm, not so sure about that. Did you look at the library? It's a server and client library built to run on Linux and Windows.
I'm not a network guy so I can't say for sure, but I doubt this library will work on Arduino without significant rework. Not to mention you will need extra hardware to make your Arduino a client or a server. Most likely the extra internet hardware will come with client/server libraries anyway, so why use this one?
The OP asked how to use a library not on the library list. No link was provided, no board details, yadda, yadda, yadda. You can lead a software wenie to a codebase but you can’t make them think.
WattsThat:
The OP asked how to use a library not on the library list. No link was provided, no board details, yadda, yadda, yadda.
Did you not see this?
Cesaario:
The library is called freeopcua.
A quick google and boom, you found it. He was asking about if he can use that specific library.
WattsThat:
You can lead a software wenie to a codebase but you can’t make them think.
Maybe it's time for someone else to do some thinking and some homework before saying implementing an external library into someone's project is that easy. Sure, adding a zip to your local Arduino library repository isn't that hard (if it's configured correctly - I've run into that before), but it can be literally impossible if the library can't be compiled or run as is.
I wouldn't care if you'd just let him know that you didn't look at the library and can't verify it'll run on an Arduino or fit into his project.
Let's try to give a little more effort for the people we're trying to help here
Power_Broker:
Ummmmm, not so sure about that. Did you look at the library? It's a server and client library built to run on Linux and Windows.I'm not a network guy so I can't say for sure, but I doubt this library will work on Arduino without significant rework. Not to mention you will need extra hardware to make your Arduino a client or a server. Most likely the extra internet hardware will come with client/server libraries anyway, so why use this one?
Actually I'm using an ESP32 module, which already has wifi. The thing is that I need to use OPCUA, and this was the only library that i found which is simple and it's written in C++.
WattsThat:
You copy the entire directory containing the library files and and any examples to the Arduino folder that contains the directory “libraries”.On a 1 to 10 scale of difficulty to implement, it’s a zero. Just remember to restart the ide after copying the files.
The problem is that it's a very large library, and all the files are inside subfolders.
I don't know what to do because the are two folders, one called "include" with just .h files, and another one called "src" with .h and .cpp files. And they reference each other by following a path like "#include <opc/common/addons_core/addon_manager.h>" and apparently arduino doesn't let me include files by their path.
So what solution do I have? Put every .h and it's respective .cpp in a single folder and remove every subfolder from the include path?
I suspect that if the library was not specifically created for the Arduino system then it will need a lot of work to make it compatible - if it is even possible to make it compatible.
Keep in mind that code written for a PC assumes that there will be an Operating System and 1 (or more) Gigabytes of RAM.
...R
Robin2:
I suspect that if the library was not specifically created for the Arduino system then it will need a lot of work to make it compatible - if it is even possible to make it compatible.Keep in mind that code written for a PC assumes that there will be an Operating System and 1 (or more) Gigabytes of RAM.
...R
I understand =/
But it's think it's worth to try at least
Easiest thing you can do is to take all the C++ source files (.h and .cpp files) and put them all in the same src folder. Then go into all the files and make sure there are no file paths in the include statements. This should fix the referencing problem.
Once that's figured out you can start to test and see if the thing will at least compile and fit on your ESP32.
Why exactly do you need this protocol in particular?
Power_Broker:
Easiest thing you can do is to take all the C++ source files (.h and .cpp files) and put them all in the same src folder. Then go into all the files and make sure there are no file paths in the include statements. This should fix the referencing problem.Once that's figured out you can start to test and see if the thing will at least compile and fit on your ESP32.
Why exactly do you need this protocol in particular?
The problem is that there is exactly 246 files, and some of them have the same name, but are in different folders. Not to mention the possibility that I can miss something in the process.
It's a college project, and I was instructed to use opc. So here I am.
I dont even know what OPC is? Maybe a laymen terms explanation would help you get better responses?
Maybe this will work for you? (not even sure if its the same thing/topic)
xl97:
I dont even know what OPC is? Maybe a laymen terms explanation would help you get better responses?Maybe this will work for you? (not even sure if its the same thing/topic)
https://www.st4makers.com/
GitHub - ildemartinez/OPC: OPC Library for ArduinoGitHub - Pro/open62541-arduino: open62541 OPC UA example for Arduino
The first 3 links depends on a software running in the computer (at least i think it depends). I looked at the 4th one before some time ago but as I'm running out of options I think I'll take a look at it again. But it's really important that I can still use the arduino IDE to code. Thanks
I think it's time to take a step back and re-evaluate the fundamental task/assignment.
What exactly is your college assignment? Can you post the assignment description?
Do you have to use an Arduino?
Does you assignment specifically call out OPC? If so, why does it call that protocol out specifically?
Do you have the ability to do testing with the servers/clients you'll be graded against (or similar ones)?
TBH, I'd use one of xl97's linked libraries if I were you. Most specifically, I'd try the library in the last link first since it's based off an example for the ESP32.
Power_Broker:
I think it's time to take a step back and re-evaluate the fundamental task/assignment.What exactly is your college assignment? Can you post the assignment description?
Do you have to use an Arduino?
Does you assignment specifically call out OPC? If so, why does it call that protocol out specifically?
Do you have the ability to do testing with the servers/clients you'll be graded against (or similar ones)?TBH, I'd use one of xl97's linked libraries if I were you. Most specifically, I'd try the library in the last link first since it's based off an example for the ESP32.
I need to develop a way to integrate arduino with OPC in a didactic way that it can be used by technical high school students. The plan is: An arduino will be making several measurements about any sensor, and the students in their computers could read these values by using any client. So, the arduino (ESP32) will play the role of server.
An example: An ESP32 will be attached to a tank and it will measure it's water level. Simultaneously, every student in the class could monitor the level in their computer via wifi.
As they are studying Industrial Automation, OPC is used, as it's largely used in industries. And the Arduino IDE is needed because it's easy to learn and could be easily re-coded by anyone.
So to summarize, the idea is to have an ESP32 running an arduino code that reads a value from a sensor and posts it into an OPC server.
The whole iot thing that is taking over is doing exactly that right?
There is a complete library with exactly your example and more available already? ESP8266WiFi
And then a free iot server? In Thingsboard it's very easy to add users (students) and give them rights to read different sensors.
Smart farming and smart agriculture solutions | ThingsBoard example
Cesaario:
The problem is that there is exactly 246 files,
I'm prepared to bet 10p 20p that that project is not going to work on an Arduino or ESP8266.
...R
Robin2:
I'm prepared to bet10p20p that that project is not going to work on an Arduino or ESP8266....R
Yup, but I would love to try.
Power_Broker:
Did you not see this?A quick google and boom, you found it. He was asking about if he can use that specific library.
Maybe it's time for someone else to do some thinking and some homework before saying implementing an external library into someone's project is that easy. Sure, adding a zip to your local Arduino library repository isn't that hard (if it's configured correctly - I've run into that before), but it can be literally impossible if the library can't be compiled or run as is.
I wouldn't care if you'd just let him know that you didn't look at the library and can't verify it'll run on an Arduino or fit into his project.
Let's try to give a little more effort for the people we're trying to help here
You can waste your time any way you see fit. I’ll do the same with mine.
Cesaario:
Yup, but I would love to try.
Feel free. I will be delighted if you are successful.
...R