We have already talked about the HTML5/javascript code running with node.js on HLS.
The latest Debian distribution available for BeagleBone Black comes with all we need already included: node.js, Bonescript, Cloud9, Mjpg-Streamer and a lot of other utilities. So the switchover on BBB resulted easy enough.

After some experience on field I learned that we need some easy and quick way to debug/setup/modify your code. The workers in a TV studio have no time to wait for long debugging sessions. I need some hardware, very low level tools to understand what's going wrong.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash

FILEPATH="/etc/network/interfacesFiles/interfaces."
FILEINTERFACES="/etc/network/interfaces"

if [ $# == 1 ]; then
	FILENAME="$FILEPATH$1"
	if [ -f $FILENAME ]; then
		if ! diff $FILENAME $FILEINTERFACES > /dev/null 2>&1; then
			/etc/init.d/networking stop > /dev/null 2>&1
			AP___FILE=$1
			if [ ${AP___FILE:0:5} == "AP___" ]; then
				update-rc.d hostapd enable > /dev/null 2>&1
				service hostapd start > /dev/null 2>&1
			else
				update-rc.d hostapd disable > /dev/null 2>&1
				service hostapd stop > /dev/null 2>&1
			fi
				rm $FILEINTERFACES > /dev/null 2>&1
				cp $FILENAME $FILEINTERFACES > /dev/null 2>&1
				/etc/init.d/networking restart > /dev/null 2>&1
		fi
	else
	  echo "File does not exist."
	fi
else
	echo
	echo
	echo "------------------------------------------------------------------------------"
	echo "network configuration"
	echo "usage: net.sh xxxxx"
	echo "where:"
	echo "xxxxx = interfaces.xxxxx network configuration file in interfacesFiles folder"
	echo "if name starts with AP___ it also enables hostapd service"
	echo "------------------------------------------------------------------------------"
	echo
	echo
fi

exit 0
Let's face up at first the WiFi configuration. Using TP-Link USB WiFi adapter and hostapd daemon the BBB can be published as an Access Point allowing an easy connection with laptop, tablet or smart-phone for telemetry and control.
But during the developing you need the board connected to your lab WiFi in order to update and install software or consult document on Internet. If you forgot to switch from a network to the other and your out of your lab WiFi network range, you need to open the cover, connect the serial console and edit /etc/network/interfaces configuration file to change network.
Using Bonescript you can use some I/Os of the BBB in the javascript code as easy as you do on Arduino.
if(b.digitalRead(sw1))
{
  child = exec('/etc/network/net.sh AP___lino');
}
else
{
  child = exec('/etc/network/net.sh WiFi_Guiott');
}
b =require('bonescript');
sw1 = 'P9_12';
sw2 = 'P9_15';
sw3 = 'P9_17';
sw4 = 'P9_18';
b.pinMode(sw1, b.INPUT);
b.pinMode(sw2, b.INPUT);
b.pinMode(sw3, b.INPUT);
b.pinMode(sw4, b.INPUT);
According to the position of the switch you can setup the network calling the external shell script...
...or modify the software behavior live
shutDownProc = function()
{
 if(b.digitalRead(sw2))
 {// if sw2 = on then poweroff BBB
   child = exec('sudo poweroff'); // poweroff
  }
};
LedB = 'P9_23';
LedG = 'P8_7';
LedY = 'P8_8';
LedR = 'P8_9';
b.pinMode(LedB, b.OUTPUT);
b.pinMode(LedG, b.OUTPUT);
b.pinMode(LedY, b.OUTPUT);
b.pinMode(LedR, b.OUTPUT);
A similar mode to define and use I/O pins as outputs...
function imuTxTimer()
{// every txTick ms
  HBledCount++;
  if(HBledCount >= HBledCycle)
  {//Blink LedB on idle cycle
  	HBledCount=0;
  	HBled=HBled ^ 1;
  	b.digitalWrite(LedB, HBled);
  }
  .....
...driving LEDs for heart-beat...
...or error displaing for a given time
...
 b.digitalWrite(LedR, 1)
  var timeoutA = setTimeout(function() 
  { 
	b.digitalWrite(LedR, 0)
  }, 1000);
  
};
f
updated on 20-07-2013
Multipurpose Cape for BBB
f

High Level Supervisor

BeagleBone Black version