| Electronic Components Datasheet Search |
|
DEV-12887 Datasheet(PDF) 37 Page - SparkFun Electronics |
|
|
|||||||||||||||||||||||||||||
DEV-12887 Datasheet(HTML) 37 Page - SparkFun Electronics |
|
37 / 40 page ![]() <html> <head> <title>Electric Imp Breakout</title> <script src="http://code.jquery.com/jquery1.9.1.min.js"> </script> <script src="http://code.jquery.com/mobile/1.3.1/jquery.mo bile1.3.1.min.js"></script> <script> $( function() { // Edit these values first! The externalURL variab le should be the // unique URL of your agent. e.g. the last part o f: // https://agent.electricimp.com/UpyYpRLmBB7m // pollRate defines how often the values on your p age will refresh. var externalURL ="UpyYpRLmBB7m"; var pollRate ="1000"; function poll(){ // Construct an ajax() GET request. // http://www.w3schools.com/jquery/ajax_ajax.a sp $.ajax({ type: "get", url: "https://agent.electricimp.com/"+exte rnalURL, // URL of our imp agent. dataType: "json", // Expect JSONformatt ed response from agent. success: function(agentMsg) { // Functio n to run when request succeeds. // jQuery find "pin1" id and overwrit e its data with "pin1" key value in agentMsg $("#pin1").html(agentMsg.pin 1); $("#pin2").html(agentMsg.pin2); $("#pin5").html(agentMsg.pin5); $("#pin7").html(agentMsg.pin7); $("#pin8").html(agentMsg.pin8); $("#pin9").html(agentMsg.pin9); $("#vin").html(agentMsg.voltage); updateBG(agentMsg.pin5); // Try thi s if you have a photocell connected to pin 5 }, error: function(err) { console.log("err"+ err.status) } }); } // setInterval is Javascript method to call a func tion at a specified interval. // http://www.w3schools.com/jsref/met_win_setinter val.asp setInterval(function(){ poll(); }, pollRate); // This function updates the function updateBG(lightSensor) { if (lightSensor > 30000) { Page 37 of 40 |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |