| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- $(document).ready(function() {
- $('#forward').click(function() {
- $.post("../cgi-bin/car.sh", "forward" );
- });
- addEventListener("keydown", function (e) {
- if (e.key === "w") {
- $.post("../cgi-bin/car.sh", "forward" );
- }
- });
- $('#reverse').click(function() {
- $.post("../cgi-bin/car.sh", "reverse" );
- });
- addEventListener("keydown", function (e) {
- if (e.key === "s") {
- $.post("../cgi-bin/car.sh", "reverse" );
- }
- });
- $('#left').click(function() {
- $.post("../cgi-bin/car.sh", "left" );
- });
- addEventListener("keydown", function (e) {
- if (e.key === "a") {
- $.post("../cgi-bin/car.sh", "left" );
- }
- });
- $('#right').click(function() {
- $.post("../cgi-bin/car.sh", "right" );
- });
- addEventListener("keydown", function (e) {
- if (e.key === "d") {
- $.post("../cgi-bin/car.sh", "right" );
- }
- });
- $('#forward_left').click(function() {
- $.post("../cgi-bin/car.sh", "forward_left" );
- });
- addEventListener("keydown", function (e) {
- if (e.key === "q") {
- $.post("../cgi-bin/car.sh", "forward_left" );
- }
- });
- $('#forward_right').click(function() {
- $.post("../cgi-bin/car.sh", "forward_right" );
- });
- addEventListener("keydown", function (e) {
- if (e.key === "e") {
- $.post("../cgi-bin/car.sh", "forward_right" );
- }
- });
- $('#reverse_left').click(function() {
- $.post("../cgi-bin/car.sh", "reverse_left" );
- });
- addEventListener("keydown", function (e) {
- if (e.key === "z") {
- $.post("../cgi-bin/car.sh", "reverse_left" );
- }
- });
- $('#reverse_right').click(function() {
- $.post("../cgi-bin/car.sh", "reverse_right" );
- });
- addEventListener("keydown", function (e) {
- if (e.key === "c") {
- $.post("../cgi-bin/car.sh", "reverse_right" );
- }
- });
- $('#all_stop').click(function() {
- $.post("../cgi-bin/car.sh", "all_stop" );
- });
- addEventListener("keydown", function (e) {
- if (e.key === "x") {
- $.post("../cgi-bin/car.sh", "all_stop" );
- }
- });
- $('#headlight').click(function() {
- $.post("../cgi-bin/car.sh", "headlight" );
- });
- addEventListener("keydown", function (e) {
- if (e.key === "x") {
- $.post("../cgi-bin/car.sh", "headlight" );
- }
- });
- $('#irled').click(function() {
- $.post("../cgi-bin/car.sh", "irled" );
- });
- addEventListener("keydown", function (e) {
- if (e.key === "x") {
- $.post("../cgi-bin/car.sh", "irled" );
- }
- });
- $('#honk').click(function() {
- $.post("../cgi-bin/car.sh", "honk" );
- });
- addEventListener("keydown", function (e) {
- if (e.key === "x") {
- $.post("../cgi-bin/car.sh", "honk" );
- }
- });
- });
|