Reply To: problem with Phonegap connect breakout js
About › Forums › Forum › problem with Phonegap connect breakout js › Reply To: problem with Phonegap connect breakout js
December 4, 2015 at 6:14 AM
#1032
Anonymous
Inactive
Here is my code. i think that is the same example as you send me. Now i can through the browser control the LED on and off, that can also know the status of button. but i can’t on my iphone open this example to control that.I also no idea how can i do that. Could you please tell me what should i do, if I want do control the LED on my iphone just like on mac. thank you so much!!!
$(document).ready(function() {
// Declare these variables so you don't have
// to type the full namespace
var IOBoard = BO.IOBoard;
var IOBoardEvent = BO.IOBoardEvent;
var LED = BO.io.LED;
var Button = BO.io.Button;
var ButtonEvent = BO.io.ButtonEvent;
// Set to true to print debug messages to console
BO.enableDebugging = true;
// If you are not serving this file from the same computer
// that the Arduino board is connected to, replace
// window.location.hostname with the IP address or hostname
// of the computer that the Arduino board is connected to.
var host = "88.67.48.195";
//window.location.hostname;
// if the file is opened locally, set the host to "localhost"
if (window.location.protocol.indexOf("file:") === 0) {
host = "localhost";
}
// attach fastclick to avoid 300ms click delay on mobile devices
FastClick.attach(document.body);
var arduino = new IOBoard(host, 8887);
// Variables
var led;
var button;
var $state = $('#state');
var $schematic = $('#schematic');
// Handle showing and hiding the schematic
$('#schematicBtn').on('click', toggleSchematicView);
// Listen for the IOBoard READY event which indicates the IOBoard
// is ready to send and receive data
arduino.addEventListener(IOBoardEvent.READY, onReady);