Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot-open:remotelab:ume:smartme:m2 [2019/10/29 11:02] pczekalskien:iot-open:remotelab:ume:smartme:m2 [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 7: Line 7:
 === Prerequisites === === Prerequisites ===
 == Liquid Crystal == == Liquid Crystal ==
-For this library, you may refer to the [[en:iot-open:remotelab:ume:smartme:b1|IB1 exercise]]. +For this library, you may refer to the [[en:iot-open:remotelab:ume:smartme:b1|B1 exercise]]. 
  
 == DHT == == DHT ==
-For this library, you may refer to the [[en:iot-open:remotelab:ume:smartme:b2|IB2 exercise]]. +For this library, you may refer to the [[en:iot-open:remotelab:ume:smartme:b2|B2 exercise]]. 
  
  
Line 42: Line 42:
 It will be possible to display the value of the temperature, measured from the sensors attached to the node where the M1 sketch had been previously launched, on the LCD attached to this node. It will be possible to display the value of the temperature, measured from the sensors attached to the node where the M1 sketch had been previously launched, on the LCD attached to this node.
 Start Start
-This exercise is to be considered as closely related to the M1 exercise. This means that if you want to reproduce a complete experiment, you have to book at least two nodes of the lab, and then you have to run both M1 and M2 sketches, one per node.+This exercise is to be considered as closely related to the M1 exercise. This means that if you want to reproduce a complete experiment, you have to book at least two nodes of the lab, and then you have to run both IM1 and IM2 sketches, one per node.
  
 === Steps === === Steps ===
Line 56: Line 56:
    
 == Step 2 == == Step 2 ==
-Instantiate the software controller component for the LCD display. Then assign to the ethernet interface a MAC and IP address, the latter valid for the internal laboratory network (192.168.0.0/24 in this case). Then instantiate the EthernetClient and MQTTClient objects. Then declare the connect() and ''messageReceived()'' functions. In particular, in the connect() body there is a call to the subscribe() function, in order to subscribe to a specific topic. In the ''messageReceived()'' body the payload of the message (the temperature value, in this case) is written in the LCD display of the node.+Instantiate the software controller component for the LCD display. Then assign to the ethernet interface a MAC and IP address, the latter valid for the internal laboratory network (192.168.0.0/24 in this case). Then instantiate the EthernetClient and MQTTClient objects. Then declare the ''connect()'' and ''messageReceived()'' functions. In particular, in the ''connect()'' body there is a call to the ''subscribe()'' function, in order to subscribe to a specific topic. In the ''messageReceived()'' body the payload of the message (the temperature value, in this case) is written in the LCD display of the node.
    
 <code c> <code c>
Line 85: Line 85:
  
 == Step 3 == == Step 3 ==
-Initialize the display and the Ethernet connection with IP and MAC address. Then launch the connection() function and initialize the MQTT client with the shift.io broker. You can visualize your device stream, after a successful connection, here: https://shiftr.io/try.+Initialize the display and the Ethernet connection with IP and MAC address. Then launch the ''connection()'' function and initialize the MQTT client with the shift.io broker. You can visualize your device stream, after a successful connection, here: https://shiftr.io/try.
  
-We suggest doing all of the above in the setup() function, as follows:+We suggest doing all of the above in the ''setup()'' function, as follows:
  
 <code c> <code c>
Line 104: Line 104:
    
 == Step 4 == == Step 4 ==
-Implement loop() to try connecting until success, as follows:+Implement ''loop()'' to try connecting until success, as follows:
    
 <code c> <code c>
Line 138: Line 138:
 </code> </code>
  
-=== M1_sub.cpp ===+=== IM2_sub.cpp ===
 <code c> <code c>
 #include <LiquidCrystal.h> #include <LiquidCrystal.h>
en/iot-open/remotelab/ume/smartme/m2.1572346925.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
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