Differences

This shows you the differences between two versions of the page.

Link to this comparison view

iot:res:streams [2015/07/20 15:39]
madalina.tanea [Switch]
iot:res:streams [2015/07/30 16:21] (current)
madalina.tanea [Social: Send and receive]
Line 23: Line 23:
  
 By connecting the two blocks you send the output of run as input for print. ​ By connecting the two blocks you send the output of run as input for print. ​
-{{ :​iot:​res:​runex.png?​300 |}}+{{ :​iot:​res:​runex.png?​400 |}}
 ===== Functions ===== ===== Functions =====
 ==== Function ==== ==== Function ====
Line 30: Line 30:
 By convention it will have a msg.payload property containing the body of the message. By convention it will have a msg.payload property containing the body of the message.
 If you double click on it, you will find the name field, the second field, where you write the code and the last one, where you specify how many outputs the node has.  If you double click on it, you will find the name field, the second field, where you write the code and the last one, where you specify how many outputs the node has. 
 +{{ :​iot:​labs:​functions.png?​300 |}}
  For this node you can find an usage example in // Course 3: Software for the Internet of Things //.  For this node you can find an usage example in // Course 3: Software for the Internet of Things //.
 ==== Visual ==== ==== Visual ====
 This node is similar to the function block, only that the second field will consist of visual blocks. This node is similar to the function block, only that the second field will consist of visual blocks.
-{{ :​iot:​labs:​functions.png?​300 |}}+
  
 Look up an example in // Lab. 03 - Blink an LED //. Look up an example in // Lab. 03 - Blink an LED //.
Line 48: Line 49:
 Find an example of how to use the node in // Course 3: Software for the Internet of Things //. Find an example of how to use the node in // Course 3: Software for the Internet of Things //.
 ===== Social: Send and receive ===== ===== Social: Send and receive =====
-You can make board communicate. The message that they exchange will be in the payload. ​+You can make boards ​communicate. The message that they exchange will be in the payload. ​
 The //Send// node needs the label, which is the identification of the expected message. It should be the same one in the receive message node. The //Send// node needs the label, which is the identification of the expected message. It should be the same one in the receive message node.
 {{ :​iot:​labs:​messages.png?​200 |}} {{ :​iot:​labs:​messages.png?​200 |}}
-The third field asks for the board ID. In //send// you need the receiver board ID.  +The third field asks for the board ID. In //send// you need the receiver board ID. To obtain it, go to the main page, find your board and, in its options, choose // Board ID// 
-{{ :​iot:​labs:​boardid.png?​200 |}}+{{ :​iot:​labs:​boardid.png?​300 |}} 
 + 
 +Here's a simple and short example on a situation where you might need this very nodes.  
 +The temperature from a room is needed. The user who has these values wants to send them to your board, for you to insert them in your own project.  
 +The first user needs a // Send message// node, a label he decides over and your board ID. He will take the values from the temperature sensor connected, say on pin A0 and include them in the message to be sent.  
 + 
 +You, on the other hand, will have to put a //Receive message// node which, in this example, will print on your console the values respective to the temperature,​ in an analog range (0 - 1024) every time it gets a message from the first board. \\ 
 +{{:​iot:​res:​receivemsg.png?​300 |}} 
 +{{ :​iot:​res:​sendmsg.png?​300 ​|}}
 ===== Say ===== ===== Say =====
 You can make the board speak. Just insert this node and specify the message and the language. ​ It will be saved in the payload. ​ You can make the board speak. Just insert this node and specify the message and the language. ​ It will be saved in the payload. ​
 {{ :​iot:​labs:​say.png?​200 |}} {{ :​iot:​labs:​say.png?​200 |}}
 +
 +For instance, a possible application would implement this block and two other simple ones: the // run // node and a change node, where you write the message you expect from your project. ​
 +
 +{{ :​iot:​res:​sayexample.png?​400 |}}
 ===== I/O pins ===== ===== I/O pins =====
   *  digitalWrite - it will write 0 or 1 on a digital pin, the one that you choose in the settings.   *  digitalWrite - it will write 0 or 1 on a digital pin, the one that you choose in the settings.
Line 63: Line 76:
   *  analogRead - writes a value on an analog/ PMM pin. Said value will be in the payload. ​   *  analogRead - writes a value on an analog/ PMM pin. Said value will be in the payload. ​
 {{ :​iot:​labs:​analogs.png?​200 |}} {{ :​iot:​labs:​analogs.png?​200 |}}
-  ​* Shift in/ out- When it receives an input, shifts in/out a byte value from a pin using the clock pin as clock. The value read/​written is in payload. If no data pin is specified, the pin number is the topic field of the message.+For these nodes you can find examples in //Course 3: Software for the Internet of Things // 
 +  ​* Shift in/ out- When it receives an input, shifts in/out a byte value from a pin using the clock pin as clock. The value read/​written is in payload. If no data pin is specified, the pin number is the topic field of the message.
 {{ :​iot:​labs:​shifts.png?​200 |}} {{ :​iot:​labs:​shifts.png?​200 |}}
 +Here's an example on how to use the //shift out// node. You want to light up 3 LEDs one by one, without changing the state of the previous one. Picture this: you have the pins connected to 3 consecutive pins of a shift register so,  you want to have on them the values: 0, 0, 0 when they are all out; 0, 0, 1 when the last pin is high; 0, 1, 1 when the last two are turned on and for all the LEDs to be alight 1, 1, 1. The corresponding values would be 0, 1, 3 and 7 which, in binary, would look exactly like the values you expect. Make a function which returns these numbers and the //shift out // node will write on the shift register exactly what you need. Make sure the data and the clock pin correspond to the shift register'​s pins. 
 +{{ :​iot:​res:​shiftoutt.png?​400 |}}
 +The easiest way to do this is to select, in the // run // node, the // Times// option, instead of // timestamp//​. This will send in the payload a number, starting with 0, which is incresing by one each time a new message is sent out. The function should look like this. 
 +{{ :​iot:​res:​exfctshiftout.png?​350 |}}
  
 ===== Signals ===== ===== Signals =====
Line 70: Line 88:
   *  sendSignal- sends the value of the payload to the signal with the same name in the dashboard or to a certain number of boards.   *  sendSignal- sends the value of the payload to the signal with the same name in the dashboard or to a certain number of boards.
 {{ :​iot:​labs:​signals.png?​200 |}} {{ :​iot:​labs:​signals.png?​200 |}}
 +Find examples of how the // send signal // node works in // Lab 05. Connecting Analog Sensors to the board and adding charts //.
 +
 +As for the // receive signal //node, you add a swith in the dashboard and name the signal it sends in a paticular way. 
 +Afterwords, you come back to your main page and add a // receive signal // node. This one will start the project when it gets the message sent from the switch, and will put in the payload the value 0 or 1, depending on the switch'​s state. You can use this value to light up an LED, for example. ​
 +{{ :​iot:​res:​example2.png?​300 |}}
 +{{ :​iot:​res:​examplereceive.png?​300 |}}
 ===== Web servers ===== ===== Web servers =====
   * http request - this block can either get, post, pull, delete the data from a web page depending on what method you choose   * http request - this block can either get, post, pull, delete the data from a web page depending on what method you choose
Line 76: Line 100:
   * Web response- it will set the response of the server. In //status// you configure it. Default is 200 which is page found.   * Web response- it will set the response of the server. In //status// you configure it. Default is 200 which is page found.
 {{ :​iot:​labs:​web.png?​200 |}} {{ :​iot:​labs:​web.png?​200 |}}
 +
 +All the additional information you need can be found  in // Course 09. Web servers // and examples in // Lab 08. Web services //.
iot/res/streams.1437395957.txt.gz · Last modified: 2015/07/20 15:39 by madalina.tanea
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0