forked from marcoschwartz/arduino-robot-wifi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
43 lines (34 loc) · 770 Bytes
/
script.js
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
41
42
function stopRobot(){
$.get( "update_state.php", {
speedLeft: "0",
speedRight: "0",
directionLeft: "1",
directionRight: "1"} );
}
function fullForward(){
$.get( "update_state.php", {
speedLeft: "100",
speedRight: "100",
directionLeft: "1",
directionRight: "1"} );
}
function turnLeft(){
$.get( "update_state.php", { speedLeft: "100",
speedRight: "100",
directionLeft: "0",
directionRight: "1"} );
}
function turnRight(){
$.get( "update_state.php", { speedLeft: "100",
speedRight: "100",
directionLeft: "1",
directionRight: "0"} );
}
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
break;
}
}
}