Hello, I am trying to use DHT11 package, but I got...
# help
s
DHT11 package can not be import in project
f
Which package are you using?
s
DHT11
f
ok.
f
Try to:
import DHT11.dht11
.
s
ok
f
That said: it should actually be
import dht11
s
But again it does not work
f
Can you show me the content of your
package.lock
file?
s
Yes, But I think the problem is related to path where the package has been installed
f
We will have a look at that in the next step.
s
prefixes: dht11: .. packages: ..: path: ..
one question, "package.lock" I created manually
Is it correct?
f
This won't work.
It's saying that it should find the package dht11 at location ..
Unless that's where you put it, it won't find it.
I would remove (or rename) the package.lock file.
And start over.
Similarly, if you have a package.yaml file, I would remove/rename it.
(unless you have important information in it).
s
i can remove them, because these files do not contain important information, So, I removed them
f
Then start again by writing:
Copy code
toit pkg init
toit pkg install github.com/nilwes/DHT11
Write these commands in your project folder.
The
init
creates an empty
package.yaml
and
package.lock
file. This initializes your directory as project root.
You can also tell
toit pkg
where your project is related with
toit pkg --project-root=... <command> ...
Generally it's easier to just locate yourself into the directory from which you want to work from.
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.
s
It works perfectly; thanks a lot. I just have to find what is the problem with my sensor that I get "read error."
f
The nilwes package is using polling to read the data.
Unfortunately that's not super reliable.
(On v2 we use the RMT hardware peripheral which is more reliable. That would be a different package, though).
I have used the nilwes package before, and my DHT11 sensors worked with it.
But if you get read-errors, if might be that the naive approach that is used in the nilwes package isn't good enough.
That said: obviously start by verifying that the cables are connected correctly.
s
can I install new version ?
f
(different modules put the vcc/do/gnd onto different pins).
We recommend to use Jaguar (v2) for all new users.
It's significantly more up to date.
It doesn't come with the cloud, though.
s
ok, interesting, I will try this now, Thanks a lot
f
The tutorial I sent you also has a section on the DHT11.
using the newer package.
s
perfect, I will do this. Thanks a lot