Electronic Components Datasheet Search
  English  ▼

X  

DEV-12887 Datasheet(PDF) 32 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) 32 Page - SparkFun Electronics

Back Button DEV-12887 Datasheet HTML 28Page - SparkFun Electronics DEV-12887 Datasheet HTML 29Page - SparkFun Electronics DEV-12887 Datasheet HTML 30Page - SparkFun Electronics DEV-12887 Datasheet HTML 31Page - SparkFun Electronics 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 Next Button
Zoom Inzoom in Zoom Outzoom out
 32 / 40 page
background image
/*  Electric Imp Web Response Example (device) 
    by: Jim Lindblom 
    SparkFun Electronics 
    date: November 5, 2013 
    license: Beerware. Use, reuse, and modify this code howeve
r you see fit. 
    If you find it useful, buy me a beer some day! 
    The idea for this code was inspired by this gist by indust
rialinternet: 
    https://gist.github.com/industrialinternet/5419730 
    This example code demonstrates how an imp can publish info
rmation to a 
    webpage. All of the imp's pins are configured as inputs. T
hey can be either 
    digital or analog.  
    There are three parts to this code: 
    1. The imp (device) code. The imp itself simply reads its 
pin values, and 
        sends them out to the agent. 
    2. The agent code. The agent waits for an http request. O
n such a request, 
        it'll construct a JSON of the imp's pin values, and re
spond with that. 
    3. An html page to make the http request and handle the re
sponse from the agent. 
        There are a number of ways to do this. See one exampl
e at the bottom of 
        The agent code. 
*/
///////////
// Setup //
///////////
// Register imp. This good practice: 
imp.configure("Imp Pin Web Response",[],[]);
// Configure pins:
hardware.pin1.configure(DIGITAL_IN_PULLUP);
hardware.pin2.configure(DIGITAL_IN_PULLUP);
hardware.pin5.configure(ANALOG_IN);
hardware.pin7.configure(DIGITAL_IN_PULLUP);
hardware.pin8.configure(DIGITAL_IN_PULLUP);
hardware.pin9.configure(DIGITAL_IN_PULLUP);
//////////////////////////
// Function Definitions //
//////////////////////////
// sendPins reads each of the pins, stores them in a table, an
d sends that 
// table out to the agent.
// It calls itself every 100ms ­­ 10 times a second.
function sendPins()
{ 
// Read each of the pins and store them in a table.
// The key names ­­ "pin1", "pin2", etc. ­­ should be kep
t the same, unless
// you also change them in the device.on() function on th
e agent.
    local pinValues =
    { 
Page 32 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