1

Hey I'm doing a project and I need to combine programs of dht11 sensor and soil moisture sensor..but they're in different directories and their libraries also. I'm not able to run them simultaneously maybe because of these libraries. how can merge them !?

5
  • Hi @shreeja kumbargoudar, Welcome and nice to meet you. Ah, Let me see. The general trick is to place all the libraries under your home directory "~", say in a sub directory called "abc". If your libraries are in python, then it is easy. This is an example of using DHT11 and PIR sensor: "Home Security System Using Rpi3, DH11, HC-SR501, A Design Project Report - J Wang, H Ping, M Fang, Cornell MSEE 2019": people.ece.cornell.edu/land/courses/eceprojectsland/STUDENTPROJ/….
    – tlfong01
    Feb 25 '20 at 7:26
  • If your libraries are also from the same source, eg AdaFruit, then it is a bit difficult, you may need to combing the setup and initialization code called "EazySetup", or CircuitPython tools, but CircuitPython is not very Rpi compatible. Perhaps you can let us know the links to your library programs so we know the problem clearer. Cheers.
    – tlfong01
    Feb 25 '20 at 7:30
  • 1
    Not Pi specific. This is a general Python problem.
    – joan
    Feb 25 '20 at 9:12
  • My answer to the following DHT11 question related to a python module. You can try to use the directory where the program is placed, then try to import the functions modified as a module/library. The DIY your simple libraries such a pretty print library, just printing debug sttements. Then use another program IN THE SAME DIRECTORY to import DHT11, your DIYed print module/library. This way you main program is using two libraries in the same directory. Of course it is harder to do then to say. But so I gradually built up my project directory with over 10 libraries, 1,000+ statements.
    – tlfong01
    Feb 25 '20 at 10:01
  • I forgot to include the links about DHT11 python program libraries for your reference. In case you are using MCP3008 ADC to read your moisture sensor, then it is easy to just include the python function (actually MCP3008 is so simple that no set up or library is necessary) (1) raspberrypi.stackexchange.com/questions/108290/… (2) raspberrypi.stackexchange.com/questions/97949/… (3) raspberrypi.stackexchange.com/questions/96560/….
    – tlfong01
    Feb 25 '20 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.