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 |
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);
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);
function imuTxTimer() {// every txTick ms HBledCount++; if(HBledCount >= HBledCycle) {//Blink LedB on idle cycle HBledCount=0; HBled=HBled ^ 1; b.digitalWrite(LedB, HBled); } .....
... b.digitalWrite(LedR, 1) var timeoutA = setTimeout(function() { b.digitalWrite(LedR, 0) }, 1000); };