Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
739b7d0
add henrywinter33.html
henrylohman Feb 23, 2015
48732f1
Merge http://github.com/saasmath/winter33
henrylohman Feb 24, 2015
b6e6568
add henrywinter34.html
henrylohman Feb 24, 2015
2d27a6f
add working dance command controlled with f
henrylohman Feb 24, 2015
e8082e1
Merge http://github.com/saasmath/winter33
henrylohman Feb 26, 2015
88a2bb8
add quick turn commands controlled with q and e
henrylohman Feb 26, 2015
4da9549
add over drive mode (sets speed to 500 forward)
henrylohman Feb 26, 2015
34034fe
over drive reverse command (control with t)
henrylohman Feb 26, 2015
f7e0c85
add overdrive command controlled with r (sets speed to 500 forward)
henrylohman Feb 26, 2015
f6fb54e
Merge http://github.com/saasmath/winter33
henrylohman Feb 27, 2015
f86e61d
add henrysong.html
henrylohman Feb 27, 2015
7a080bf
Merge http://github.com/saasmath/winter33
henrylohman Mar 3, 2015
ceef33e
add robot modifications folder
henrylohman Mar 4, 2015
3a2ce83
Delete USETHISONEoverdrivehenrywinter34.html
henrylohman Mar 4, 2015
a972fdd
Merge http://github.com/saasmath/winter33
henrylohman Mar 4, 2015
6e30835
Delete dancehenrywinter34.html
henrylohman Mar 4, 2015
1cb89bb
Delete overdrivehenrywinter34.html
henrylohman Mar 4, 2015
125e03f
Delete overdrivereversehenrywinter34.html
henrylohman Mar 4, 2015
0d6f817
Delete quickturnhenrywinter34.html
henrylohman Mar 4, 2015
c9143fb
add robot modification package, including overdrive, quick turn, forw…
henrylohman Mar 4, 2015
7e03d69
Merge http://github.com/henrylohman/winter33
henrylohman Mar 4, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions demos/henrysong.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<!DOCTYPE html>
<html>

<head>
<title>Birthday Song demo</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="../css/styles.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>
<style>
body {
background-color: OldLace; //make different so pages can be known on sight.
}
</style>

<script>
var tempo = 2000;
mysong = [
[293.7, tempo * .1875],
[293.7, tempo * .0675],
[329.6, tempo * .25],
[293.7, tempo * .25],
[392, tempo * .25],
[370, tempo * .5],
[null, tempo * .25],
[293.7, tempo * .1875],
[293.7, tempo * .0675],
[329.6, tempo * .25],
[293.7, tempo * .25],
[440, tempo * .25],
[392, tempo * .5],
[null, tempo * .0625],
[null, tempo * .0625], //extra nulls so rests happen
[null, tempo * .0625], //at pauses (every 16 notes)
[293.7, tempo * .1875],
[293.7, tempo * .0675],
[587.3, tempo * .25],
[493.9, tempo * .25],
[392, tempo * .25],
[370, tempo * .25],
[329.6, tempo * .25],
[null, tempo * .5],
[523.3, tempo * .125],
[523.3, tempo * .125],
[493.9, tempo * .25],
[392, tempo * .25],
[440, tempo * .25],
[392, tempo * .5]
];

$(document).ready(function() {

$("#togglesensors").click(function(e) {
$("#allsensors").toggleClass('hidden');
});
var socket = io.connect('http://10.48.102.xxx:3001'); //change this to match your robot
socket.on('sensordata', function(data) {
$("#voltage").text(data.battery.voltage.volts.toFixed(2));
$("#current").text(data.battery.current.amps.toFixed(2));
var power = data.battery.voltage.volts * data.battery.current.amps;
$("#power").text(power.toFixed(2));
$("#allsensors").text(JSON.stringify(data));
});




$("#playsong").click(function(e) {
socket.emit('sing', mysong);
});

$("#passiveMode").click(function(e) {
socket.emit('passiveMode');
});
$("#safeMode").click(function(e) {
socket.emit('safeMode');
});

$("#fullMode").click(function(e) {
socket.emit('fullMode');
});


$('body').keydown(function(event) {

console.log(event.which);
if (event.which === 80) //p - play

{
event.preventDefault();
socket.emit('sing', mysong);
}

if (event.which === 49) //1 -- Play tune when 1 is pressed

{
event.preventDefault();
socket.emit('sing', [
[640, 100],
[650, 100]
]);
}

});

});
</script>

</head>

<body>
<div class="container">

<div class="row">
<div class="col-xs-3 sensor-block col-xs-offset-1">
<div class="sensor-title">Voltage</div>
<div class="sensor-value" id="voltage">...</div>
</div>
<div class="col-xs-3 sensor-block col-xs-offset-1">
<div class="sensor-title">Current</div>
<div class="sensor-value" id="current">...</div>
</div>
<div class="col-xs-3 sensor-block col-xs-offset-1">
<div class="sensor-title">Power</div>
<div class="sensor-value" id="power">...</div>
</div>
</div>

<h3>Robot Control</h3>
<div class="row">
<button class="btn-success btn col-md-2" id="passiveMode">Passive Mode</button>
<button class="btn-warning btn col-md-2" id="safeMode">Safe Mode</button>
<button class="btn-danger btn col-md-2" id="fullMode">Full Mode</button>
</div>

<div class="row">
<div class="col-xs-3">
<button id="playsong" class="btn-success btn-lg btn-block">Play Music
<span class="glyphicon glyphicon-music"></span>
</button>
</div>
</div>

<div class="row">
<button id="togglesensors">Toggle Sensors</button>
<div class="hidden" id="allsensors">...</div>
</div>

</div>

</body>

</html>
Loading