Skip to content

Instantly share code, notes, and snippets.

@jadonk
jadonk / qb_showain.html
Created Feb 18, 2014
Quickly read the AIN values on BeagleBone Black for debugging the Quickbot (http://o-botics.org/robots/quickbot/). To install, open Cloud9 IDE on your board (http://<bot's IP address>:3000), create a new file and paste this content, then click the PREVIEW button.
View qb_showain.html
<!-- Quickbot testing -->
<html>
<head>
<title>Quickbot testing</title>
<script src="http://beagleboard.org/static/jquery.js"></script>
<script src="http://beagleboard.org/static/bonescript.js"></script>
</head>
<body>
<h1>jQuery Demo</h1>
<p>AIN0 = <span id="ain0"></span></p>
View dokaraoke.sh
#!/bin/bash
pactl load-module module-loopback
while true
do
DISPLAY=:0 chrt -f 50 /usr/games/pycdg "`ls /root/karaoke/*.cdg | shuf -n 1`"
done
View fiddle.html
<h1>BoneScript Flot Demo</h1>
<div id="myplot" style="width:500px;height:300px;"></div>
<p><a href="https://gist.github.com/jadonk/9602198">fork me on github</a></p>
View jsbin.uderuw.html
<html>
<header>
<script src="http://wavedrom.googlecode.com/svn/trunk/skins/default.js"></script>
<script src="http://wavedrom.googlecode.com/svn/trunk/WaveDrom.js"></script>
</header>
<body onload="WaveDrom.ProcessAll()">
<h2>WaveDrom Example</h2>
WaveDrom timing diagrams can be embedded into the web pages, blogs, wiki pages:
View output.txt
root@beaglebone:~/bonescript# node test-dbus-native-wicd.js
onGetConnectionStatus: {"0":null,"1":[2,["192.168.2.130","XXXXX\" Nickname:\"MT7601STA","92","-1","65 Mb/s"]]}
onGetNumberOfNetworks: {"0":null,"1":11}
View dokaraoke.sh
#!/bin/bash
# On BeagleBone Black running Debian (http://beagleboard.org/latest-images)
# * apt-get install pykaraoke
# * Load a bunch of .cdg/.mp3 files
# * Run this script
#pactl load-module module-loopback || echo "No microphone found or pulseaudio not running" && exit
#alsaloop -C hw:1,0 -P plughw:0,0 --channels=1 --tlatency=10000 --daemonize
#setterm -blank 0
#setterm -powerdown 0
while true
View dcmotor.js
var b = require('bonescript');
var MOTOR = 'P9_16';
var FORWARD = 'P9_18';
var BACKWARD = 'P9_22';
var POT = 'P9_36';
var BUTTON = 'P8_19'
var speed = 0;
var increment = 0.01;
var direction = 1;
View servo.js
var b = require('bonescript');
var SERVO = 'P9_14';
var duty_min = 0.03;
var position = 0;
var increment = 0.01;
var scale = 0.090;
//b.pinMode(SERVO, b.OUTPUT);
updateDuty();
View cylon-servo.js
var Cylon = require('cylon-beaglebone/node_modules/cylon');
Cylon.robot({
connection: {name: 'beaglebone', adaptor: 'beaglebone'},
device: {name: 'servo', driver: 'servo', pin: 'P9_14'},
work: function(my) {
var angle = 45 ;
my.servo.angle(angle);