Skip to content

Instantly share code, notes, and snippets.

View w4ilun's full-sized avatar
🤖

w4ilun w4ilun

🤖
View GitHub Profile
var m = require('mraa'); //require mraa
console.log('MRAA Version: ' + m.getVersion()); //write the mraa version to the console
var myLed = new m.Gpio(13); //LED hooked up to digital pin 13 (or built in pin on Galileo Gen1 & Gen2)
myLed.dir(m.DIR_OUT); //set the gpio direction to output
var ledState = true; //Boolean to hold the state of Led
periodicActivity(); //call the periodicActivity function
function periodicActivity()
var m = require('mraa'); //IO Library
var app = require('express')(); //Express Library
var server = require('http').Server(app); //Create HTTP instance
var io = require('socket.io')(server); //Socket.IO Library
var blinkInterval = 1000; //set default blink interval to 1000 milliseconds (1 second)
var ledState = 1; //set default LED state
var myLed = new m.Gpio(13); //LED hooked up to digital pin 13
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.socket.io/socket.io-1.2.1.js"></script>
<script>
$(function(){
var socket = io.connect('http://INTEL_EDISON_IP_ADDRESS:3000');
$('#slider').on('input change',function(){
socket.emit('changeBlinkInterval',$(this).val());
});
@w4ilun
w4ilun / emc-test.js
Last active August 29, 2015 14:22
EMC Test
//var exec = require('child_process').exec;
//var dgram = require('dgram');
//var client = dgram.createSocket('udp4');
var groveSensor = require('jsupm_grove');
var loudnessSensor = require('jsupm_groveloudness');
var touchModule = require('jsupm_ttp223');
var vibrationModule = require('jsupm_ldt0028');
var LCD = require('jsupm_i2clcd');
var digitalAccelerometer = require('jsupm_mma7660');
@w4ilun
w4ilun / package.json
Created June 3, 2015 16:53
XDK Daemon Target
{
"name": "sample",
"description": "",
"version": "0.0.0",
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"dependencies": {
}
wget --no-check-certificate https://raw.githubusercontent.com/intel-iot-devkit/upm/master/examples/javascript/grovetemp.js && node grovetemp.js
var groveSensor = require('jsupm_grove'); //UPM sensor
var app = require('express')(); //Express Library
var server = require('http').Server(app); //Create HTTP instance
var io = require('socket.io')(server); //Socket.IO Library
var tempSensor = new groveSensor.GroveTemp(0); //temperature sensor connected to analog pin 0
app.get('/', function(req, res) {
res.sendfile(__dirname + '/index.html'); //serve the static html file
});
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.socket.io/socket.io-1.2.1.js"></script>
<script>
$(function(){
var socket = io.connect('http://INTEL_EDISON_IP_ADDRESS:3000');
var temperature = $('#temperature');
socket.on('temperature',function(data){
temperature.html(data.celsius);
@w4ilun
w4ilun / ffserver.conf
Created October 25, 2015 01:31
ffserver config file for Intel Edison
HTTPPort 8090
# bind to all IPs aliased or not
HTTPBindAddress 0.0.0.0
# max number of simultaneous clients
MaxClients 1000
# max bandwidth per-client (kb/s)
MaxBandwidth 10000
<Feed feed1.ffm>
File /tmp/feed1.ffm
@w4ilun
w4ilun / start_stream.sh
Created October 25, 2015 01:33
start ffserver and ffmpeg
./ffserver &
./ffmpeg -r 25 -s 640x480 -f video4linux2 -i /dev/video0 http://localhost:8090/feed1.ffm