var led = new Pin(4);
var toggle=1;
setInterval(function() {
toggle=!toggle;
digitalWrite(led, toggle);
}, 500);
//You should see the LED connected to D2 blinking:
There is also a DH22 module that you could try in the software require(DH22).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Try the example at the end of this link to see if the pin is correct.
http://crufti.com/getting-started-with-espruino-on-esp8266/
There is also a DH22 module that you could try in the software require(DH22).