Added beeping when battery low
This commit is contained in:
37
index.html
37
index.html
@@ -14,17 +14,12 @@
|
||||
<script src="jquery.min.js"></script>
|
||||
<script src="bootstrap.min.js"></script>
|
||||
|
||||
<!-- <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> -->
|
||||
|
||||
<script src="roslib.js"></script>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<audio id="audio" src="beep-04.mp3" autostart="false" ></audio>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
ws://192.168.1.102:9090
|
||||
var ros = new ROSLIB.Ros();
|
||||
|
||||
ros.connectionName = 'ws://192.168.1.102:9090';
|
||||
@@ -71,7 +66,7 @@ ws://192.168.1.102:9090
|
||||
|
||||
voltageListener.subscribe(function(message) {
|
||||
updateVoltage(message.battery_voltage_1/1000);
|
||||
// voltageListener.unsubscribe();
|
||||
updateUpTime(message.up_time)
|
||||
});
|
||||
|
||||
function updateVoltage(voltage)
|
||||
@@ -97,6 +92,9 @@ ws://192.168.1.102:9090
|
||||
else if ( voltage_percentage <= 25)
|
||||
{
|
||||
document.getElementById("VoltageDisplay").className = "progress-bar progress-bar-danger"
|
||||
var sound = document.getElementById("audio");
|
||||
sound.play()
|
||||
console.log("Pay Sound")
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -104,6 +102,11 @@ ws://192.168.1.102:9090
|
||||
}
|
||||
}
|
||||
|
||||
function updateUpTime(time)
|
||||
{
|
||||
document.getElementById("UpTime").innerHTML = time
|
||||
}
|
||||
|
||||
window.setInterval(function(){
|
||||
// ShowTime();
|
||||
}, 100);
|
||||
@@ -140,8 +143,11 @@ ws://192.168.1.102:9090
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Pelican Status </div>
|
||||
<div class="panel-heading">
|
||||
Pelican Status
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<label class="col-sm-2"> Battery Voltage: </label>
|
||||
<div class="progress">
|
||||
<div id="VoltageDisplay" class="progress-bar progress-bar-striped active" role="progressbar"
|
||||
@@ -149,9 +155,18 @@ ws://192.168.1.102:9090
|
||||
No data recieved yet.
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-2"> Up Time: </label>
|
||||
<div class="col-sm-1" id="UpTime" align="left">
|
||||
N/A
|
||||
</div>
|
||||
<div>
|
||||
seconds
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user