Electronic Components Datasheet Search
  English  ▼

X  

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

Back Button DEV-12887 Datasheet HTML 22Page - SparkFun Electronics DEV-12887 Datasheet HTML 23Page - SparkFun Electronics DEV-12887 Datasheet HTML 24Page - SparkFun Electronics DEV-12887 Datasheet HTML 25Page - SparkFun Electronics DEV-12887 Datasheet HTML 26Page - SparkFun Electronics DEV-12887 Datasheet HTML 27Page - SparkFun Electronics DEV-12887 Datasheet HTML 28Page - SparkFun Electronics DEV-12887 Datasheet HTML 29Page - SparkFun Electronics DEV-12887 Datasheet HTML 30Page - SparkFun Electronics Next Button
Zoom Inzoom in Zoom Outzoom out
 26 / 40 page
background image
/* Agent for imp Web­Controlled LEDs 
    by: Jim Lindblom 
    SparkFun Electronics 
    date: November 1, 2013 
    license: Beerware. Please use, reuse, and modify this cod
e. 
    If you find it useful, buy me a beer some day! 
    This is the agent portion of the LED Web Controller. It de
fines how http 
    requests to https://agent.electricimp.com/XXXXXXXXXXXX ar
e handled. Check  
    your agent URL to find out what, exactly, XXXXXXXXXXXX is. 
    For example, if your agent url is https://agent.electricim
p.com/UpyYpRLmBB7m 
    sending https://agent.electricimp.com/UpyYpRLmBB7m?led=0 s
hould turn the 
    lonely red led off.  https://agent.electricimp.com/UpyYpRL
mBB7m?led=1 would 
    turn the LED on. 
    * There are also request handlers for "rgb", which should 
be a #RRGGBB 
      formatted string. E.g: https://agent.electricimp.com/Upy
YpRLmBB7m?rgb=%238500b7 
    * A "user" request handler can receive a string. E.g.: htt
ps://agent.electricimp.com/UpyYpRLmBB7m?user=Jim 
    * And a "timer" handler looks for a number­looking strin
g. E.g.: 
      https://agent.electricimp.com/UpyYpRLmBB7m?timer=10 
    The parameters can be combined in one request. E.g.: 
    https://agent.electricimp.com/UpyYpRLmBB7m?led=1&rgb=%237f
3fff&timer=10&user=Jim 
*/
// At the start, print a message to say we're online, and prin
t the agent URL:
server.log("LED Web Control Agent Online: " + http.agenturl
()); 
// requestHandler handles all http requests coming into the ag
ent. It's only
// setup to look for a select few requests: "led", "rgb", "use
r" and "timer".
function requestHandler(request, response)  {
try { // Try provides us with exception handling, in case 
a runtime error occurs
// check if the user sent led as a query parameter
if ("led" in request.query) {
// if they did, and led=1.. set our variable to 1
if ((request.query.led == "1") || (request.query.l
ed == "0"))
            { 
// convert the led query parameter to an integ
er
                local ledStatus = request.query.led.tointeger
(); 
// send "led" message to device, and send ledS
tate as the data
Page 26 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