I want to control led’s over a mobile app… Can u plz brief me the procedure
Please read this.
Hi Lokesh,
Will share the updated details with you in a couple of days.
Meanwhile, you can use below Html code to control your LED. Just replace API_KEY and BOLT_ID.
------LED_CONTROL.html--------
<html>
<head>
<!-- In following line will load the boltCommands.js files from Bolt cloud.-->
<!--<script type="text/javascript" src="https://cloud.boltiot.com/static/js/boltCommands.js"></script>-->
<script type="text/javascript">
// The following line will set the api key and device name. It will be auto-initialized by Bolt cloud.
//setKey('xxxxxx','xxxxxx');
var api_key='xxxxxxxxx'
var device_id='BOLTxxxxxxx' //'BOLT123456'
</script>
<script type="text/javascript">
function digitalWrite(pin,val){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200 ) {
//document.getElementById("javascript_response").innerHTML = "Javascript Response : "+xmlhttp.responseText;
//alert(xmlhttp.responseText);
var obj = JSON.parse(xmlhttp.responseText);
if(obj.success=="1" && val=='HIGH'){
alert('LED Turned on Successfully');
}
if(obj.success=="1" && val=='LOW'){
alert('LED Turned off Successfully');
}
}
};
xmlhttp.open("GET", "http://cloud.boltiot.com/remote/"+api_key+"/digitalWrite?pin="+pin+"&state="+val+"&deviceName="+device_id,true);
xmlhttp.send();
}
</script>
</head>
<body>
<center>
<!-- In below line, We are calling the digitalWrite function from boltCommands.js file to switch on the LED. -->
<button onClick="digitalWrite(0,'HIGH');" target="_blank">ON</button>
<!-- In below line, we are calling the digitalWrite function from boltCommands.js file to switch off the LED. -->
<button onClick="digitalWrite(0,'LOW')">OFF</button>
</center>
</body>
</html>