Pixl.js + grove sensors #3029
Replies: 7 comments
-
|
Posted at 2019-07-27 by maze1980 Change the DHT22to DHT11 in your code. |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-07-27 by AkosLukacs Hi! Using the Pixl should be almost the same as any other Espruino, pins are different, and different amount of peripherials, but most basic examples in most tutorials should work just fine. The DHT11 and DHT22 use different protocol. Are you using the right one? |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-07-27 by Robin Sat 2019.07.27 Welcome to the world of Javascript @user98241 as I know you will enjoy many hours of discovery with your purchase of Pixl.
Excellent resource with a tryit window option: The language itself:
On the 'Grove' page, the code within the commented out sections just indicate an alternate way in which commands could be used. It's there to aid as a hint, and to avoid having to look up each command, which may be done at: It also appears that the commented out sections may be a suggestion on how to set up the declarations section, and the viewable code lines show usage, for the specific section beneath the heading in blue.
Is there a specific example? It would depend on which command, which sensor etc. A combination of command lookup in the above link, and searching the manufacturer data sheet would be a good idea.
On the device specific page, beneath the Tutorials heading there are at least fifty:
Has the tutorials and samples page been discovered yet? Tons there also: |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-07-29 by @gfwilliams On http://www.espruino.com/Grove you've got some code up the top (under 'Software') that you can use pretty much as-is. For instance for Pixl.js you just do: However from
As it happens I don't believe there is a library for the DHT11 on Grove, but Grove itself is nothing special - it's just a connector, so what you were doing with: Sounds spot on - just as others have said you'll need to use the DHT11 module if you have a DHT11 - and ensure that you're using the right pin for it (as Grove connectors have two pins - a connector labelled D3 will probably use pins D3 and D4). Do you have a link to the exact arduino grove shield you're using? It might be that you're having issues because the shield is expecting power on the '5v' rail: http://www.espruino.com/Pixl.js#shield-power |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-07-31 by user98241 Hi all, Thanks for all your help! Will definitely look through those links, and I've gotten a much better understanding of how everything works. This is the arduino shield and temperature + humidity sensor being used: |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-07-31 by @gfwilliams Is the PWR led on on that shield? For it to work you'd need the switch set to 3.3v OR for Vin and 5v to be shorted together (either with the Pixl's solder jumper, or just with a wire on the Arduino headers). And how are you powering the Pixl.js? via a 3v battery, or USB? http://www.espruino.com/DHT11 says:
So that could be what you're getting? The DHT11 is a digital device, so Espruino can detect if it's working/connected correctly or not. If something goes wrong it'll report back |
Beta Was this translation helpful? Give feedback.
-
|
Posted at 2019-07-31 by Robin Wed 2019.07.31
Doesn't hurt to verify what mode the pins being checked actually are: In addition to the comments in #7 concerning powering, how is the DHT11 grounded to the Pixl? A floating ground might be an issue with the randomness that is observed. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-07-27 by user98241
Hello!
We are beginners with javascript and are confused on how to interface the sensors with the Pixl.js.
It doesn't seem too complicated, but there aren't many examples on how to use them together. We've looked at this, but are confused why certain parts of the code are commented out, or what we would put in the (...) sections.
http://www.espruino.com/Grove
Also, specifically for the temp + humidity sensor, we found the DHT11 module and tried using that as well:
But this doesn't return any raw values.
temp and humidity = -1
The sensor should be connected to the right pin and we have also made sure to flash the Pixl.js with the most recent firmware 2v04. What could be the issue with this?
Also, is there any sample code we could refer to in javascript for the other sensors?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions