Bringing in request

Let's write a basic program without Johnny-Five to collect our data on the Pi before adding in our LCD. In a file on your Pi or ready to be moved to your Pi called weather-test.js:

const request = require('request')

setInterval(() => {
request({
url: 'http://api.openweathermap.org/data/2.5/weather',
qs: {
q: [your city],
appid: [your API key],
units: ['metric' or 'imperial']
},
json: true // returns the parsed json body for us
}, (err, resp, body) => {
console.log(body)
})
}, 60000)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.25.217