| Electronic Components Datasheet Search |
|
DEV-12887 Datasheet(PDF) 33 Page - SparkFun Electronics |
|
|
|||||||||||||||||||||||||||||
DEV-12887 Datasheet(HTML) 33 Page - SparkFun Electronics |
|
33 / 40 page ![]() pin1 = hardware.pin1.read(), pin2 = hardware.pin2.read(), pin5 = hardware.pin5.read(), pin7 = hardware.pin7.read(), pin8 = hardware.pin8.read(), pin9 = hardware.pin9.read(), voltage = hardware.voltage() // We'll also send th e operating voltage. } // Once the table is constructed, send it out to the agen t with "impValues" // as the identifier. agent.send("impValues", pinValues); // Schedule a wakeup in 100ms, with a callback to this fun ction. imp.wakeup(0.1, sendPins); } sendPins(); // Call sendPins once, and let it do the rest of t he work. Per usual, check out the code comments for a line-by-line overview of what’s going on. The new function this time? agent.send(string, object) . agent.send is used to send data from the imp, to the agent. This time we need to create a handler on the agent side to deal with the data sent by the imp. Speaking of agent code… The Agent Code On the agent side we need to accomplish two tasks: 1. Define an imp handler function to deal with the data sent by the imp. We’ll just store the data sent by the imp into a global variable. 2. Create another handler to be called when an HTTP request is received. Upon receiving the request the agent will construct a response based on the data received from the imp, and send that out to the requester. There’s the overview, here’s the code. Copy and paste this into the Agent half of your model: Page 33 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 |