| 전자부품 데이터시트 검색엔진 |
|
DEV-12887 데이터시트(PDF) 33 Page - SparkFun Electronics |
|
|
|||||||||||||||||||||||||||||
DEV-12887 데이터시트(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 |
|
링크 URL |
| ALLDATASHEET 가 귀하에 도움이 되셨나요? [ DONATE ] |
Alldatasheet는? | 광고문의 | 운영자에게 연락하기 | 개인정보취급방침 | 링크 투 데이터시트 | 링크교환 | 제조사별 검색 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 |