Created
November 28, 2019 10:50
-
-
Save johnroyer/2be4b7d9e06c386125973a5f46ac4033 to your computer and use it in GitHub Desktop.
try to new Pin object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webduino = require('webduino-js'); | |
board = new webduino.WebArduino('Ge8pn'); | |
board.on('ready', function (board) { | |
var pin = new webduino.core.Pin(board, 10, Pin.DOUT); | |
board.systemReset(); | |
board.samplingInterval = 250; | |
var replay = new webduino.module.Relay(board, 10); | |
exit; | |
toggle(relay); | |
}); | |
function toggle(relay) { | |
var now = new Date(); | |
var hour = Date.getHours(); | |
if ( 6 < hour ) { | |
relay.on(); | |
} | |
if ( 18 < hour ) { | |
relay.off(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment