From 96238f8b794a017ec8d45aae58e56e354c136a7d Mon Sep 17 00:00:00 2001 From: mikiper98 <48826955+mikiper98@users.noreply.github.com> Date: Wed, 10 Apr 2019 14:59:14 +0200 Subject: [PATCH] Booking control via external LED I wanted to turn a green LED on when it's free and a red LED when it's boocked. is this the right way? --- src/components/booked.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/booked.js b/src/components/booked.js index 7496bc6..cd2fecd 100644 --- a/src/components/booked.js +++ b/src/components/booked.js @@ -3,6 +3,13 @@ import React from 'react'; import Button from './button'; import { humanReadableDuration, timeLeft } from './../util'; +var Gpio = require('onoff').Gpio; +var LED1 = new Gpio(4,'out'), + LED2 =new Gpio(17,'out'); + +LED1.writeSync(1); +LED2.writeSync(0); + const bookedStatusSubMessage = (currentEvent) => { const remainingTime = humanReadableDuration(timeLeft(currentEvent)); return `for the next ${remainingTime}`;