Hi,
I am super new to Arduino and web programming so go easy on me. I wanted to create a simple application where I could flip a switch in a jQuery mobile application and it would change the state of a digital pin on the Yun.
I have part of the process working. So far I have:
- Compiled the Bridge example on the Yun and can send url commands like /arduino/digital/13/1 successfully
- Created a simple jquery form html page with a flipswitch which I wish to use to change the pin state
What I am trying to understand is the (presumably) javascript that is triggered when the switch is moved sending the required url. I have read a little about json, jquery and looked at a few examples but can't quite understand the mechanism.
My index.html is as follows:
<!DOCTYPE html>
<html>
<head>
<title>Coffee Timer</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Welcome</h1>
</div>
<form>
<label for="OnOff">Power</label>
<input type="checkbox" data-role="flipswitch" name="OnOff" id="OnOff">
</form>
</body>
</html>
I would appreciate some guidance on closing the loop so I can get playing with the next steps.
Thanks.