@@ -22,7 +22,7 @@ var timetaken = "Time until button was pressed:";
2222function setupButtons ( ) {
2323// let button = [];
2424for ( let pin of pinIn ) {
25- button [ pin ] = new Gpio ( pin , "in" , "falling " , { debounceTimeout : 500 } ) ;
25+ button [ pin ] = new Gpio ( pin , "in" , "rising " , { debounceTimeout : 500 } ) ;
2626 console . log ( `Waiting for button to be pressed. Pin ${ pin } ` ) ;
2727 }
2828}
@@ -82,7 +82,10 @@ async function makeMachineCold(pinOut) {
8282 await sleep ( 500 ) ;
8383// Next, the machine will check whether the tray was previously marked unavailable
8484 if ( availableTray [ tray ] == 1 ) {
85- console . log ( `Item ${ label [ tray ] } at tray ${ tray } unavailable` )
85+ // console.log(`Item ${label[tray]} at tray ${tray} unavailable`)
86+ const pino = new Gpio ( pinOut , "out" ) ;
87+ pino . writeSync ( 0 ) ;
88+ // console.log(`Making machine cold anyway`);
8689 return ;
8790 }
8891// Third, the machine will check if it is actually hot, and only close the circuit then
@@ -93,12 +96,15 @@ async function makeMachineCold(pinOut) {
9396// On the test relay the pins are inverted, in production they should be 0 to close
9497 pino . writeSync ( 0 ) ;
9598 state = 0 ;
96- console . log ( `Machine is now ${ stateLabel [ state ] } .` )
99+ // console.log(`Machine is now ${stateLabel[state]}.`)
97100 checkTrays ( ) ;
98101 }
99102// If condition 0 & 1 are not met, it will do nothing.
100103 else {
101- console . log ( `Machine is already ${ stateLabel [ state ] } . Doing nothing.` )
104+ // console.log(`Machine is already ${stateLabel[state]}. Doing nothing.`)
105+ const pino = new Gpio ( pinOut , "out" ) ;
106+ pino . writeSync ( 0 ) ;
107+ // console.log(`Making machine cold anyway`);
102108 }
103109}
104110
0 commit comments