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:itt:relay [2018/12/06 06:36] rim.puksen:iot-open:remotelab:itt:relay [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
-===== Relay module =====+===== ITT Relay module =====
 This laboratory is located in the office of ITT Group in Tallinn, Estonia. This laboratory is located in the office of ITT Group in Tallinn, Estonia.
  
Line 11: Line 11:
  
 ==== Technical details ==== ==== Technical details ====
-This laboratory consists of a relay module attached to the ITT IoT controller module. Relay module is an electrically operated switch of mains voltage. It means that it can be turned on or off, letting the current go through or not. Many relays use an electromagnet to mechanically operate the switch and provide electrical isolation between two circuits.+This laboratory consists of a relay module attached to the ITT IoT controller module. The relay module is an electrically operated switch of the mains voltage. It means that it can be turned on or off, letting the current go through or not. Many relays use an electromagnet to mechanically operate the switch and provide electrical isolation between two circuits.
  
 === Sensors === === Sensors ===
Line 34: Line 34:
  
 ==== Hands-on labs ==== ==== Hands-on labs ====
-//List study scenarios (hands-on labs), linking to the Dokuwiki pages with hands-on labs descriptions (there should be a separate page for each scenario). Classify each scenario and refer to the target group using starting keywords+ 
-  * Beginners +=== Example code === 
-  * Undergraduates + 
-  * Masters +<code c> 
-  * Professionals + 
-Noteassume that more professional group automatically contains less professional onesNote - use language and as appropriate to the target group, i.e.:// +#include <Arduino.h> 
-<code> +#include <ittiot.h> 
-  * Beginners: Elementary operations on the Arduino 2x16 LCD screen+ 
-  * Undergraduates: Visualizing temperature and humidity on the remote screen+#define RELAY_PIN 5 
-  * Masters: Using power saving states to limit power consumption.+ 
 +// If the message received switch relay 
 +void iot_received(String topic, String msg) 
 +
 +  Serial.print("MSG FROM USER callbacktopic: "); 
 +  Serial.print(topic)
 +  Serial.print(" payload"); 
 +  Serial.println(msg); 
 +  if(msg == "1") 
 +  
 +    digitalWrite(RELAY_PIN, HIGH); 
 +  } 
 + 
 +  if(msg == "0"
 +  { 
 +    digitalWrite(RELAY_PINLOW); 
 +  } 
 +
 + 
 +void iot_connected() 
 +
 +  Serial.println("MQTT connected callback"); 
 +  iot.subscribe("relay"); 
 +  iot.log("IoT relay example!"); 
 +
 + 
 +void setup() 
 +{ 
 +  Serial.begin(115200); 
 +  Serial.println("Booting"); 
 + 
 +  iot.printConfig(); // print json config to serial 
 +  iot.setup(); 
 +  pinMode(RELAY_PIN, OUTPUT); 
 +
 + 
 +void loop() 
 +
 +  iot.handle();   
 +  delay(200); 
 +
 + 
 </code> </code>
 +
 ==== Support ==== ==== Support ====
-//Give some information on how to access help, how to get support in case of the trouble etc.//+info@ittgroup.ee
  
en/iot-open/remotelab/itt/relay.1544078176.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