OmnibotWebcontrol: Unterschied zwischen den Versionen

Aus Hackerspace Ffm
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „<pre> <!DOCTYPE html> <html> <body> <button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1600)">Forward</button> <p id="demo"></p> <p>A function i…“)
 
Zeile 6: Zeile 6:
  
 
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1600)">Forward</button>
 
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1600)">Forward</button>
 +
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(2000)">Backward</button>
 +
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(2200)">Left</button>
 +
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1800)">Right</button>
 +
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1400)">BeepmodeOn</button>
 +
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(2600)">Test2</button>
 +
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(2400)">Test3</button>
 +
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(2800)">Test4</button>
 +
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1200)">LeftForward</button>
 +
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1000)">LeftBackward</button>
 +
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(800)">RightForward</button>
 +
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(4600)">BeepmodeOff</button>
 +
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(163)">LowBeep</button>
 +
<input id="slider2" type ="range" min ="50" max="10000" step ="50" value ="100" onchange="myFunctionRange(this.value);"/>
  
 
<p id="demo"></p>
 
<p id="demo"></p>
  
<p>A function is triggered when the button is clicked. The function outputs some text in a p element with id="demo".</p>
+
<p>This is a very basic control for your OMNIBOT!</p>
  
 
<script>
 
<script>
 
function myFunctionOff() {
 
function myFunctionOff() {
     document.getElementById("demo").innerHTML = "Hello World";
+
     document.getElementById("demo").innerHTML = "OFF";
 
     gainObj.gain.value = 0;
 
     gainObj.gain.value = 0;
 
}
 
}
 
function myFunctionOn(f) {
 
function myFunctionOn(f) {
     document.getElementById("demo").innerHTML = "Hello World2";
+
     document.getElementById("demo").innerHTML = "ON";
 +
    osc.frequency.value = f;
 +
    setTimeout(10);
 +
    gainObj.gain.value = 1;
 
      
 
      
 +
}
 +
function myFunctionRange(f) {
 +
    document.getElementById("demo").innerHTML = f;
 
     osc.frequency.value = f;
 
     osc.frequency.value = f;
 +
    setTimeout(10);
 
     gainObj.gain.value = 1;
 
     gainObj.gain.value = 1;
 
      
 
      
Zeile 36: Zeile 56:
 
</body>
 
</body>
 
</html>
 
</html>
 +
  
 
</pre>
 
</pre>

Version vom 24. Juli 2017, 23:19 Uhr


<!DOCTYPE html>
<html>
<body>

<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1600)">Forward</button>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(2000)">Backward</button>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(2200)">Left</button>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1800)">Right</button>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1400)">BeepmodeOn</button>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(2600)">Test2</button>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(2400)">Test3</button>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(2800)">Test4</button>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1200)">LeftForward</button>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(1000)">LeftBackward</button>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(800)">RightForward</button>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(4600)">BeepmodeOff</button>
<button onmouseup="myFunctionOff()" onmousedown="myFunctionOn(163)">LowBeep</button>
<input id="slider2" type ="range" min ="50" max="10000" step ="50" value ="100" onchange="myFunctionRange(this.value);"/>

<p id="demo"></p>

<p>This is a very basic control for your OMNIBOT!</p>

<script>
function myFunctionOff() {
    document.getElementById("demo").innerHTML = "OFF";
    gainObj.gain.value = 0;
}
function myFunctionOn(f) {
    document.getElementById("demo").innerHTML = "ON";
    osc.frequency.value = f;
    setTimeout(10);
    gainObj.gain.value = 1;
    
}
function myFunctionRange(f) {
    document.getElementById("demo").innerHTML = f;
    osc.frequency.value = f;
    setTimeout(10);
    gainObj.gain.value = 1;
    
}
context = new AudioContext;
osc = context.createOscillator();
osc.type=osc.SQUARE;
osc.frequency.value = 440;
osc.start(0);
var gainObj = context.createGain();
gainObj.gain.value = 0;
osc.connect(gainObj);
gainObj.connect(context.destination);
</script>

</body>
</html>