Last active
April 1, 2017 06:47
-
-
Save manashmandal/4842c85b51a2c3e7189d8b3b958c1a10 to your computer and use it in GitHub Desktop.
Arduino Event : Introduction to Arduino & JavaScript
This file contains hidden or 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 Cylon = require('cylon'); | |
Cylon.robot({ | |
connections: { | |
arduino: { adaptor: 'firmata', port: 'COM8' } | |
}, | |
devices: { | |
led: { driver: 'led', pin: 13 } | |
}, | |
work: function(my) { | |
every((1).second(), my.led.toggle); | |
} | |
}).start(); |
This file contains hidden or 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
//commands: npm install cylon-firmata cylon-gpio cylon-i2c | |
const requestify = require('requestify'); | |
const five = require('johnny-five'); | |
const port = "COM8"; | |
// var board = new five.Board({ | |
// port: port | |
// }); | |
// board.on('ready', function() { | |
// var led = new five.Led(13); | |
// led.blink(100); | |
// }); | |
// requestify.get('http://webwork.manash.me/test_data.php?data=100').then(function(response) { | |
// console.log(response.getBody()); | |
// }); | |
var Cylon = require('cylon'); | |
Cylon.robot({ | |
connections: { | |
arduino: { adaptor: 'firmata', port: 'COM8' } | |
}, | |
devices: { | |
led: { driver: 'led', pin: 13 } | |
}, | |
work: function(my) { | |
every((1).second(), my.led.toggle); | |
} | |
}).start(); |
This file contains hidden or 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 success = false; | |
requestify.get('http://webwork.manash.me/test_data.php?data=100').then( | |
function(response) { | |
var pos = response.body.search('SUCCESS'); | |
if (pos >= 0) success = true; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment