This commit is contained in:
Max 2020-10-10 17:37:24 +01:00
parent 5f2a549387
commit 62c585d11f

View File

@ -35,6 +35,21 @@ app.post('/setlight', async function (request, responce) {
led_array.color = Number(request.body.color)
// Now make an api call to the led controller
axios({
url: 'http://192.168.0.27:5000/setState',
method: 'post',
data: {
power: led_array.power,
brightness: led_array.brightness,
color: led_array.color
}
})
.catch((err) => {
console.error(err)
responce.send({ success: false, error: "NETWORK" })
})
.then(() => {
axios({
url: 'http://192.168.0.27:5000/setState',
method: 'post',
@ -51,6 +66,7 @@ app.post('/setlight', async function (request, responce) {
.then(() => {
responce.send({ success: true, error: false })
})
})
}
else {