Electronic Components Datasheet Search
  English  ▼

X  

DEV-12887 Datasheet(PDF) 38 Page - SparkFun Electronics

Part # DEV-12887
Description  Electric Imp Breakout Hookup Guide
PDF  40 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  SPARKFUN [SparkFun Electronics]
Direct Link  https://www.sparkfun.com/
Logo SPARKFUN - SparkFun Electronics

DEV-12887 Datasheet(HTML) 38 Page - SparkFun Electronics

Back Button DEV-12887 Datasheet HTML 32Page - SparkFun Electronics DEV-12887 Datasheet HTML 33Page - SparkFun Electronics DEV-12887 Datasheet HTML 34Page - SparkFun Electronics DEV-12887 Datasheet HTML 35Page - SparkFun Electronics DEV-12887 Datasheet HTML 36Page - SparkFun Electronics DEV-12887 Datasheet HTML 37Page - SparkFun Electronics DEV-12887 Datasheet HTML 38Page - SparkFun Electronics DEV-12887 Datasheet HTML 39Page - SparkFun Electronics DEV-12887 Datasheet HTML 40Page - SparkFun Electronics  
Zoom Inzoom in Zoom Outzoom out
 38 / 40 page
background image
                    document.body.style.backgroundColor = "#FF
FFFF";
                } 
else
                { 
                    document.body.style.backgroundColor = "#AA
AAAA";
                } 
            } 
        }); 
</script>
</head>
<body>
<h3>Imp Pins:</h3>
<div id="pins">
<p> <b>Pin 1:</b> <span id="pin1"><!­­ This is where t
he pin 1 reading will go ­­></span></p>
<p> <b>Pin 2:</b> <span id="pin2"><!­­ This is where t
he pin 2 reading will go ­­></span></p>
<p> <b>Pin 5:</b> <span id="pin5"><!­­ This is where t
he pin 5 reading will go ­­></span></p>
<p> <b>Pin 7:</b> <span id="pin7"><!­­ This is where t
he pin 7 reading will go ­­></span></p>
<p> <b>Pin 8:</b> <span id="pin8"><!­­ This is where t
he pin 8 reading will go ­­></span></p>
<p> <b>Pin 9:</b> <span id="pin9"><!­­ This is where t
he pin 9 reading will go ­­></span></p>
<p> <b>Voltage:</b> <span id="vin"><!­­ This is where 
the voltage reading will go ­­></span></p>
</body>
</html>
Before saving and closing the file, edit this line of code to point to your
agent’s unique URL:
var externalURL ="UpyYpRLmBB7m"; // Put your agent's unique URL here
Sweet! Save and open the file with your favorite web browser. Assuming
your imp is running with the new device/agent code, you should see
something like this:
Those 1’s, 0’s, and other numbers might be a little different on your screen.
Try pressing a button. Or cover the photocell. Or mess with the imp’s pins
in some other way. Are the values changing? How cool is that!
The code for this webpage is a little ugly. It uses some web “stuff” that my
fragile, electrical engineer mind can barely grasp. There may be a better
way to do this, but this works for us. If you find another cool way to request
and use data from the imp, let us know in the discussion section!
Towards the bottom of the HTML code is a series of <span> tags, with
id s like “pin1”, “pin2” etc. But they’re blank. Remember those, they’ll come
in handy.
The real magic here is happening in the poll() function in the <script>
area up top. This function sets up an AJAX) request to the Electric Imp
agent. If the request succeeds, function(agentMsg) is executed. This
function parses the JSON message received from the agent, and
Page 38 of 40



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40


Datasheet Download

Go To PDF Page


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


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
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