guild icon
Toit
#Hello, I am trying to use DHT11 package, but I got this error although I installed the package
Thread channel in help
Shadi
Shadi 11/24/2022 09:45 AM
DHT11 package can not be import in project
floitsch
floitsch 11/24/2022 09:45 AM
Which package are you using?
Shadi
Shadi 11/24/2022 09:45 AM
DHT11
floitsch
floitsch 11/24/2022 09:46 AM
ok.
floitsch
floitsch 11/24/2022 09:46 AM
Try to: import DHT11.dht11.
Shadi
Shadi 11/24/2022 09:46 AM
ok
floitsch
floitsch 11/24/2022 09:46 AM
That said: it should actually be import dht11
Shadi
Shadi 11/24/2022 09:47 AM
But again it does not work
floitsch
floitsch 11/24/2022 09:48 AM
Can you show me the content of your package.lock file?
Shadi
Shadi 11/24/2022 09:48 AM
Yes, But I think the problem is related to path where the package has been installed
floitsch
floitsch 11/24/2022 09:49 AM
We will have a look at that in the next step.
Shadi
Shadi 11/24/2022 09:51 AM
prefixes:
dht11: ..
packages:
..:
path: ..
Shadi
Shadi 11/24/2022 09:51 AM
one question, "package.lock" I created manually
Shadi
Shadi 11/24/2022 09:51 AM
Is it correct?
floitsch
floitsch 11/24/2022 09:51 AM
This won't work.
floitsch
floitsch 11/24/2022 09:51 AM
It's saying that it should find the package dht11 at location ..
floitsch
floitsch 11/24/2022 09:51 AM
Unless that's where you put it, it won't find it.
floitsch
floitsch 11/24/2022 09:52 AM
I would remove (or rename) the package.lock file.
floitsch
floitsch 11/24/2022 09:52 AM
And start over.
floitsch
floitsch 11/24/2022 09:52 AM
Similarly, if you have a package.yaml file, I would remove/rename it.
floitsch
floitsch 11/24/2022 09:52 AM
(unless you have important information in it).
Shadi
Shadi 11/24/2022 09:53 AM
i can remove them, because these files do not contain important information, So, I removed them
floitsch
floitsch 11/24/2022 09:53 AM
Then start again by writing:
toit pkg init toit pkg install github.com/nilwes/DHT11
floitsch
floitsch 11/24/2022 09:54 AM
Write these commands in your project folder.
floitsch
floitsch 11/24/2022 09:55 AM
The init creates an empty package.yaml and package.lock file.
This initializes your directory as project root.
floitsch
floitsch 11/24/2022 09:55 AM
You can also tell toit pkg where your project is related with toit pkg --project-root=... <command> ...
floitsch
floitsch 11/24/2022 09:55 AM
Generally it's easier to just locate yourself into the directory from which you want to work from.
floitsch
floitsch 11/24/2022 09:56 AM
Even easier is to open folder in vscode, and then new terminal (a menu item of vscode).
That puts you automatically into the right place.
Shadi
Shadi 11/24/2022 09:58 AM
It works perfectly; thanks a lot. I just have to find what is the problem with my sensor that I get "read error."
floitsch
floitsch 11/24/2022 09:58 AM
The nilwes package is using polling to read the data.
floitsch
floitsch 11/24/2022 09:58 AM
Unfortunately that's not super reliable.
floitsch
floitsch 11/24/2022 09:59 AM
(On v2 we use the RMT hardware peripheral which is more reliable. That would be a different package, though).
floitsch
floitsch 11/24/2022 09:59 AM
I have used the nilwes package before, and my DHT11 sensors worked with it.
floitsch
floitsch 11/24/2022 10:00 AM
But if you get read-errors, if might be that the naive approach that is used in the nilwes package isn't good enough.
floitsch
floitsch 11/24/2022 10:00 AM
That said: obviously start by verifying that the cables are connected correctly.
floitschfloitsch
(On v2 we use the RMT hardware peripheral which is more reliable. That would be a different package, though).
Shadi
Shadi 11/24/2022 10:00 AM
can I install new version ?
floitsch
floitsch 11/24/2022 10:00 AM
(different modules put the vcc/do/gnd onto different pins).
ShadiOPShadi
can I install new version ?
floitsch
floitsch 11/24/2022 10:01 AM
We recommend to use Jaguar (v2) for all new users.
floitsch
floitsch 11/24/2022 10:01 AM
It's significantly more up to date.
floitsch
floitsch 11/24/2022 10:01 AM
It doesn't come with the cloud, though.
floitsch
floitsch 11/24/2022 10:01 AM
Get Started with Toit This document provides simple instructions on how to get started with Toit. It is loosely inspired by Makerfab's MicroPython course and uses the same hardware. In Europe the kits are available here: https://hitechchain.se/en/makerfabs/29-iot/makepython-esp32-dev-kit If you ...
Shadi
Shadi 11/24/2022 10:02 AM
ok, interesting, I will try this now, Thanks a lot
👍1
floitsch
floitsch 11/24/2022 10:02 AM
The tutorial I sent you also has a section on the DHT11.
floitsch
floitsch 11/24/2022 10:03 AM
using the newer package.
Shadi
Shadi 11/24/2022 10:04 AM
perfect, I will do this. Thanks a lot
46 messages in total