Differences

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

Link to this comparison view

Next revision
Previous revision
cs:sw:01-mervis:attaching-1-wire-devices-hidden [2020/01/17 07:21]
avsetula created
cs:sw:01-mervis:attaching-1-wire-devices-hidden [2024/03/14 09:15] (current)
kcerny typos
Line 1: Line 1:
-FIXME - překlad +====== ​Připojení ​1-Wire ​zařízení ​====== 
-====== ​Attaching ​1-Wire ​devices ​====== +<WRAP group> 
-In this tutorial, we are going to demonstratehow to connect ​[[https://​www.unipi.technology/​1-wire-temperature-sensor-p63?​categoryId=3|1-Wire ​temperature sensor]] and create very simple temperature regulator+<WRAP half column 81%> 
 +V tomto tutoriálu se dozvítejak zapojit ​[[https://​www.unipi.technology/​1-wire-temperature-sensor-p63?​categoryId=3|1-Wire ​teploměr]] a vytvořit si velmi jednoduchý regulátor teploty 
 +</​WRAP>​ 
 +<WRAP half column 15%> 
 +;;# 
 +<​html><​span class="​dev-tag dev-patron">​Patron</​span></​html>​ \\ 
 +<​html><​span class="​dev-tag dev-neuron">​Neuron</​span></​html>​ \\ 
 +<​html><​span class="​dev-tag dev-unipi11">​Unipi&​nbsp1.1</​span></​html>​ \\ 
 +<​html><​span class="​dev-tag dev-axon">​Axon</​span></​html>​ 
 +;;# 
 +</​WRAP>​ 
 +</​WRAP>​
  
-===== Prerequisites ===== +<WRAP center round box> 
-  * UniPi controller running ​Mervis OS +<​html><​span class="​kbBlue-H4alt">​Co budete potřebovat?</​span></​html>​ 
-  * Basic project in Mervis IDE in **Full mode** with +  * kontrolér Unipi se spuštěným ​Mervis OS 
-    * attached controller +  * základní projekt v Mervis IDE **Plném módu** s:  
-    * created ModbusTCP channel with the UniPi controller device +    * připojeným kontrolérem 
-    * defined ​**Executable project** with one program +    * nadefinovaným kanálem Modbus TCP pro komunikaci s PLC 
-    * setted ​**Autogen** on the Unipi controller device +    * nadefinovaným ​**spustitelným projektem** s jedním programem 
-    * defined task running a program from **Executable project** +    * nastaveným ​**Autogenem** na kontroléru ​Unipi 
-    * successfully executed **Build** +    * nadefinovaným taskem se spuštěným programem ze **spustitelného projektu** 
-  * [[https://​www.unipi.technology/​power-supplies-c15|24V power supply]] +    * úspěšně provedenou kompilací 
-  * [[https://​www.unipi.technology/​1-wire-temperature-sensor-p63?​categoryId=3|1-Wire ​temperature sensor]]+  * [[https://​www.unipi.technology/​power-supplies-c15|24 V⎓ zdroj]] 
 +  * [[https://​www.unipi.technology/​1-wire-temperature-sensor-p63?​categoryId=3|1-Wire ​teploměr]]
  
-In this tutorial, we will use [[https://​www.unipi.technology/​unipi-neuron-l503-p105?​categoryId=10|Unipi Neuron L503]].+Pro účely tohoto tutoriálu použijeme kontrolér ​[[https://​www.unipi.technology/​cs/neuron-c2|Unipi Neuron L503]]. 
 +</​WRAP>​
  
-===== Attaching ​1-Wire ​temperature sensor ​=====+===== Připojení ​1-Wire ​senzoru ​===== 
 +Všechny potřebné informace o připojování senzorů založených na čipu DS18B20 naleznete [[cs:​automation:​02-glossary:​1wire-hidden|zde]].
  
-You can find all the informations about how to connect the DS18B20 based temeperature sensor [[en:​hw:​05-1-wire|here]]. +===== Nakonfigurování ​1-Wire ​sběrnice v Mervisu ​===== 
- +Předpokládejme,​ že Vaše Mervis IDE nyní vypadá takto
-===== Configuring ​1-Wire ​bus in Mervis ​===== +
-Let's assume your Mervis IDE workspace looks like this:+
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-01-basic-project.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-01-basic-project.png?​direct |}}
  
-Right click on the **PLC** ​in the **Solution** tab of the **Left panel**. Click on the **Add channel** option.+Klikněte pravým tlačítkem myši na **PLC** ​v nabídce ​**Sestava** na **levém panelu**. Pak klikněte na **Přidat kanál**. 
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-02-add-channel.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-02-add-channel.png?​direct |}}
  
-New channel called ​**channel** ​will appear under the PLC. It is hightlightedso in the **Properties** panelyou can see its propertiesFirst, change the name of the channel to something more descriptive,​ in this example ​**1wire**.+Nový kanál nazvaný ​**channel** ​se objeví pod jménem ​PLC. Je označenýv panelu ​**Vlastnosti** proto můžete vidět jeho atributy. Nejprve změňte název kanálu na něco více informativníhonapř. **1-wire**. 
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-02-set-channel-name.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-02-set-channel-name.png?​direct |}}
  
-Second parameter we need to change is the protocolThe 1-Wire ​protocol is "hidden" ​in the **PlatformIO** ​option of the **Protocol** dropdown menu.+Druhý parametr, který je třeba změnit, je komunikační protokolProtokol ​1-Wire ​je "skryt" ​pod volbou ​**PlatformIO** ​v rozbalovacím menu **Protokol**. 
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-04-set-channel-protocol.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-04-set-channel-protocol.png?​direct |}}
  
-And select the **OneWire** ​link protocol from the corresponding dropdown menu.+Zobrazí se další rozbalovací menu, ve kterém vyberte linkový protokol ​**OneWire** ​
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-04-set-channel-link-protocol.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-04-set-channel-link-protocol.png?​direct |}}
  
-===== Detecting ​1-Wire ​sensors ​=====+Nyní je nutné **Nahrát sestavu** do PLC, aby se v PLC vytvořil komunikační kanál **OneWire**. 
 + 
 +===== Detekce ​1-Wire ​senzorů ​=====
  
-1-Wire ​bus is a serial buswhich can interconnect many sensorsEach sensor has its unique HW addressthrough which the master of the bus addresses the slave and reads data fromTherefor we need to tell UniPi controller to look for a certain devices on the busLuckilywe can detect all the sensors on the bus and then select the ones we are interested in.+Sběrnice ​1-Wire ​je sériovou sběrnicíkterá může sloužit pro propojení velkého množství senzorůKaždý senzor má svou vlastní unikátní hardwarovou adresuskrze kterou zařízení v režimu Master adresuje Slave senzory a odečítá z nich data. Z toho důvodu musíme kontrolér Unipi nastavit tak, aby na sběrnici vyhledal specifickou HW adresuNaštěstí můžeme na sběrnici nadetekovat všechny připojené senzory a až poté si vybrat tyse kterými budeme dále pracovat
  
-To detect the sensors, right click on the **1wire** ​channel name under the PLC in the **Solution** tab of the **Left panel**. In the context ​menu, click on the **Detect One Wire Sensors**.+Pro detekci senzorů klikněte pravým tlačítkem myši na jméno kanálu ​**1wire** ​v záložce ​**Sestava** **levém panelu**. V kontextovém ​menu pak klikněte na **Detekce čidel OneWire**. 
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-06-detect-one-wire-sensors.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-06-detect-one-wire-sensors.png?​direct |}}
  
-To run the detection, the controller has to be in the **Commissioning mode**. The Mervis IDE will warn you and will set the mode for the detection and after detection change the mode of the controller backJust confirm the warning by clicking on **Next >**.+Pro spuštění detekce musí být kontrolér spuštěn v **módu oživování**. Mervis IDE Vám zobrazí varovnou zprávu a po potvrzení automaticky kontrolér do daného módu přepnePo skončení detekce pak kontrolér přepne zpět. Vám stačí pouze potvrdit varování kliknutím na **Další ​>​**. ​
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-07-switching-to-commissioning-mode.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-07-switching-to-commissioning-mode.png?​direct |}}
  
-If you follow this tutorial preciselythe Mervis IDE will show an error that the **Selected channel does not exist in the PLC**.+Pokud jste vše provedli správně, Mervis IDE zobrazí chybovou hlášku s textem ​**Vybraný kanál v PLC neexistuje**. 
  
 <WRAP center round tip 60%> <WRAP center round tip 60%>
-When you define new channel, the Mervis IDE will not be able to work with ituntil you **Deploy** the solution to the PLC+Při přidávání nového kanálu jej Mervis IDE nebude moci použítdokud do PLC **nenahrajete sestavu**.
 </​WRAP>​ </​WRAP>​
  
-**Deploy** the solution and run the detection againThe dialog **Detect ​OneWire ​Sensors** will appear and should contain a sensor you just connectedIf you have more sensorsyou should see all of themTo import ​the sensor into the **Solution**, tick the **Import** ​checkbox and click on **Next >**+**Nahrajte sestavu** a spusťte detekci znovuObjeví se dialog **Detekce čidel ​OneWire**, ve kterém by se měl objevit senzor připojený k Vašemu PLCPokud jste připojili senzorů víceměli byste je vidět všechnyPro import ​senzoru do **sestavy** zaškrtněte políčko ​**Import** ​a klikněte na **Další>**
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-09-selecting-sensors.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-09-selecting-sensors.png?​direct |}}
  
-The importing of the sensor will proceed and finish with restoring the PLC's mode.+Import senzoru bude následně zakončen navrácením ​PLC zpět do původního módu
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-10-restoring-previous-state.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-10-restoring-previous-state.png?​direct |}}
  
-Since we added new devicewe need to **Set autogen** to have the temperature variables available in the programYou should already know the drill Right click on the sensor name -> **Set Autogen** ​and confirm the dialog by clicking ​**OK**.+Jelikož jsme přidali nové zařízeníje třeba ​**nastavit Autogen**, abychom mohli teplotní proměnné v programu použítPráce s Autogenem už by pro Vás měla být snadným úkolem ​klikněte pravým tlačítkem na jméno senzoru ​-> **Nastavit ​Autogen** ​a potvrďte kliknutím na **OK**. ​
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-11-set-autogen.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-11-set-autogen.png?​direct |}}
Line 74: Line 88:
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-12-set-autogen-dialog.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-12-set-autogen-dialog.png?​direct |}}
  
-===== Debugging solution ​===== +===== Ladění sestavy ​===== 
-The Mervis IDE has a feature called ​**Debugging**, which allows to connect to the running UniPi controllerread its state and even alter the variables on-the-flyTo start the debugging, click on the **Start Debugging** button on the **Ribbon**.+Mervis IDE je vybaven možností ​**ladění programů**, které umožňuje ​ připojit se k zapnutému kontroléru Unipičíst jeho stavy a dokonce i upravovat proměnné za choduPro spuštění ladění na **vrchní liště** klikněte na **Start ladění**. 
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-13-debug.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-13-debug.png?​direct |}}
  
-To view the variables and their state in debug mode, click on the **Variable Browser** tab on the **Main window**. You will be presented with all the variables available in the controller. You can use searching by **Name**. Our temperature sensor has been autonamed ​"​1W-Thermometer" ​(check the device in the **Left panel** under the **1wire** channel)so enter this name into the **Name** searchbox. The variable containing the actual temperature is called **1W-Thermometer_Temperature** and its current value in PLC is **29.875**°C.+Pro zobrazení proměnných a jejich stavu v módu ladění klikněte na záložku ​**Prohlížeč proměnných** na **hlavním panelu**. Zobrazí se seznam všech dostupných proměnných v kontroléru (pro vyhledávání můžete použít hledání podle **jména**)Teploměr bude mít automaticky přiřazený název ​"​1W-Thermometer" ​a jeho aktuální hodnota je **29,875** °C. 
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-14-variable-browser.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-14-variable-browser.png?​direct |}}
  
-===== Programming a temperature regulator ​===== +===== Programování regulátoru teploty ​===== 
-We have connected the temperature sensor to our controller and verifiedthat we can read current temperature. Now we can use it in very simple temperature regulator.+V této fázi máme ke kontroléru připojený teploměr a ověřili jsme siže můžeme odečítat teplotní údajeNyní je můžeme použít pro vytvoření velmi jednoduchého teplotního regulátoru
  
-We will be monitoring temperature and if the temperature will be under 30°C, we will turn the ''​RO2.1''​ ''​ON'' ​and when the temperature will be greater or equal to 30°Cwe will turn the ''​RO2.1''​ ''​OFF''​. ​The ''​RO2.1'' ​will represent a heating element.+Úkolem regulátoru bude sledovat teplotu a při jejím poklesu pod 30 °C sepnout relé ''​RO2.1'' ​do stavu ''​ON''​. Pokud naopak teplota přesáhne nebo bude rovna 30 °Cregulátor relé ''​RO2.1'' ​přepne do stavu ''​OFF''​. ''​RO2.1'' ​zde bude představovat topné těleso
  
-We could "hardwire" ​the temperature "​30°C"​ into the programbut we wouldn'​t be able to change it afterwards other than reprogramming the PLC. Most likely, we would like to set the threshold ​(or desiredtemperature by some knobbuttons or even HMI deviceSo it is better to define it as another variable and set the threshold by changing the variable'​value. Later we can wire this variable to some other HW input.+Teoreticky bychom nyní mohli nastavit programu pevnou teplotu ​"30 °C", to by nám ale později zabránilo v její pozdější změně jiným způsobem než opětovným přeprogramováním ​PLC. Hraniční ​(či požadovanouteplotu bychom nejspíše nastavovali tlačítkemovladačem či skrze HMI rozhraní, bude proto lepší teplotu definovat jako další proměnnou a nastavit hraniční hodnotu pomocí změny hodnoty této proměnnéPozději můžeme proměnnou propojit ​jiným hardwarovým vstupem
  
-Our program will therefor need two inputs: ''​measured_temperature'' ​and ''​threshold_temperature''​. ​In programmingeach variable has to have some type - a definitionof what it can storeIt can be integerreal numberbooleancharacterstring of characters or even more complicated typeTemperature by its nature is real number and so will be our variables ''​measure_temperature''​ and ''​threshold_temperature''​.+Program tak bude vyžadovat dva vstupy: ''​namerena_teplota'' ​''​hranicni_teplota''​. ​Při programování musí mít každá proměnná přiřazený určitý typtj. definici hodnotykterou může mítProměnná může být ve formě integerureálného číslabooleanu (tj. binární 0/1)znaku či řetězce znakůpřípadně jiného komplikovanějšího typuTeplotní údaj je ze své podstaty reálné číslo, naše proměnné proto budou nastaveny stejně
  
-We also need one output: ​''​heating_on'', ​which will be boolean, because the heating will be only ''​ON'' ​or ''​OFF'' ​represented by the boolean values ​''​TRUE'' ​and ''​FALSE''​. ​The naming ​''​heating_on'' ​will help us to identify, that it contains ​state of the heating. And we can easilly saythat heating_on ​= true, then the heating is ON.+Potřebovat budeme rovněž i booleanový výstup ​''​topeni_zapnuto'', ​neboť topení bude mít pouze stavy ''​ON'' ​nebo ''​OFF'' ​reprezentované booleanovými hodnotami ​''​TRUE'' ​''​FALSE''​. ​Název ​''​topeni_zapnuto'' ​nám pomůže v rozpoznání stavu topení ​rovněž díky tomu můžeme definovatže pokud topeni_zapnuto ​= true, topení je ve stavu ON. 
  
-Let's start creating our program. ​Programming has to be done when the **Debugging** is stoppedso stop it by clicking on the **Stop ​Debugging** on the **Ribbon**, if you have it still runningThen double click on the name of the program in the **Left panel** to display it in the **Main window**.+Začněmě tedy tvořit samotný ​program. ​Nejprve je třeba vypnout ​**Ladění**, zastavte jej proto kliknutím na **Stop ​ladění** **horní liště**. Následně dvojitě klikněte na jméno programu v **levém panelu** pro jeho zobrazení v **hlavním panelu**. 
  
-If you remember, in the **Variable browser**, the name of temperature variable was **1W-Thermometer_Temperature**. The name is autogenerated,​ and the first part is from the name of the sensorThat's not very descriptiveso we will change the name of the sensor to **office**, because ​it is measuring temperature in our officeClick on the name of the sensor in the **Left panel**. In the **Properties panel**, you can see property ​**Name**. Change it's value to **office** and either click on the **V** or submit by **ENTER** ​key+**Prohlížeči proměnných** jsme proměnnou teploty nazvali jako **1-Wire-Thermometer-Temperature**. Toto jméno se generuje automaticky a jeho první část představuje název senzoruTento název ale není příliš popisnýsenzor proto přejmenujeme na **kancelar**, neboť s ním chceme měřit teplotu v kanceláři**levém panelu** klikněte na název senzoru a v panelu ​**Vlastnosti** najděte vlastnost ​**Název**. Změňte jeho hodnotu na **kancelar** a potvrďte buď kliknutím na {{:​files:​dialog-confirm_button_2.png?​nolink|}} nebo stisknutím klávesy ​**ENTER**. ​
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-16-sensor-name.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-16-sensor-name.png?​direct |}}
  
-That will rename the variable ​**1W-Thermometer_Temperature** ​to **office_Temperature**. You can check it in the **Variable Browser**. Now we can place the temperature onto the program canvas to **Input area**. Right click on the **Input area** and click on **Global Variables** -> **Insert Existing Variable**. The **Insert Existing Variable** dialog will appear and you can search for the **office_Temperature** variable and confirm the adding by clicking on **OK**+Proměnná ​**1W-Thermometer_Temperature** ​se tím přejmenuje na **kancelar_teplota**. Změnu můžete zkontrolovat v **Prohlížeči proměnných**. Nyní teplotu umístíme do programu do **sekce vstupů**. Klikněte pravým tlačítkem na **sekci vstupů** a klikněte na **Globální proměnné** -> **Vložit existující proměnnou**. Objeví se dialog ​**Vložit existující proměnnou**, ve kterém můžete snadno vyhledat proměnnou ​**kancelar_Temperature** a potvrdit její výběr kliknutím na **OK**
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-17-selecting-variable.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-17-selecting-variable.png?​direct |}}
  
-Now we need to add second input, the **threshold_Temperature**. This variable doesn'​t exist yetso we cannot add it from existing variables as we did with **office_Temperature**. Right click on the **Input area** where you want to place the input and click on **Global Variables** -> **Create New Variable**. In the **Create New Variable** dialog, enter the name **threshold_Temperature**, set the type to **real** ​and set the default value to **30**. ​And click on **OK**.+Nyní je třeba přidat druhý vstup **hranicni_Temperature**. Tato proměnná v tuto chvíli neexistujenemůžeme ji proto vyhledat v existujících proměnných jako **kancelar_teplota**. Klikněte pravým tlačítkem v **sekci vstupů** na místo, kam chcete vstup umístit, a klikněte na **Globální proměnné** -> **Vytvořit novou proměnnou**. V dialogu ​**Vytvořit novou proměnnou** zadejte název ​**hranicni_teplota**, nastavte typ na **real** ​a nastavte výchozí hodnotu na **30**. ​Potvrďte kliknutím na **OK**. ​
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-18-create-new-variable-dialog.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-18-create-new-variable-dialog.png?​direct |}}
  
-The last thing with setting inputs and outputs is to define the output, the ''​RO2.1''​. ​Right click on the **Output area** and click on **Global variables** -> **Insert Existing Variable**. In the list of variables look for **RO** ​and select the ''​Neuron_L503_RO_2.01_w''​. ​If you don't have unit with relay outputsyou can use DO insteadthe logic is the same.+Posledním krokem při nastavování vstupů a výstupů je nadefinovat výstup ​''​RO_2.01''​. ​Klikněte pravým tlačítkem na **sekci výstupů** a klikněte na **Globální proměnné** -> **Vložit existující proměnnou**. seznamu proměnných pak vyhledejte ​**RO** ​a vyberte výstup ​''​Neuron_L503_RO_2.01_w''​. ​Digitální výstupy mají stejnou logiku jako reléové výstupypoužít tak můžete jak ROtak i DO
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-19-insert-ro201.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-19-insert-ro201.png?​direct |}}
  
-And if everything went wellyou should have similar program canvas+Pokud bylo vše provedeno správněhlavní panel bude vypadat zhruba následovně. ​
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-20-inputs-outputs.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-20-inputs-outputs.png?​direct |}}
  
-Now we can fill the **Logic area** with some "high level" ​logicWe need to compare the ''​office_Temperature'' ​against ​''​threshold_Temperature''​. ​We will need to place some **Function block** to achieve thisSwitch the **Left panel** into **FUPLA ​Box Explorer** tabYou can see list of categories, which have subcategories,​ which have subcategories,​... Since we don't knowhow the desired FB is namedwe can only guess where it can beSince we want to compare two analogue valuesit could be in the **Basic Analogue Boxes**, so open the tree in **FUPLA Box Explorer**We want to compare two variableswhich has something to do with **Mathematics** ​category - open itAnd you can see **Compare Functions** ​at the bottom of the categoryOpen it, and you can see a list of FBs with encryptic names like **eq**, **ge**, **gt**,... Good thing about Mervis IDE is the very extensive help manualYou can right click on each box and select ​**Help** to learn more about each of the FBsThe correct box we are looking for is **LT**, or **Less than**.+Nyní můžeme ​**logickou sekci** vyplnit ​"vysokoúrovňovou" ​logikouPotřebujeme kontroléru sdělit, aby porovnával proměnnou ​''​kancelar_teplota'' ​s proměnnou ​''​hranicni_teplota''​. ​K tomu budeme potřebovat několik ​**funkčních bloků**. **levém panelu** přepněte na záložku ​**FUPLA ​bloky**. Ta nyní zobrazuje seznam kategorií, z nichž každá má subkategorie ​ty mají své vlastní subkategorie...jelikož nevímejak se námi hledaný funkční blok jmenujemůžeme nyní jen hádatProtože budeme porovnávat dvě analogové hodnotynáš hledaný blok by mohl být v kategorii ​**Basic Analogue Boxes**. ​Kliknutím ji rozbalte. Porovnávání dvou proměnných se týká matematikyotevřeme proto subkategorii ​**Mathematics**. ​Na konci této subkategorie pak naleznete podřízenou kategorii ​**Compare Functions** ​sdružující porovnávací matematické funkceJejím otevřením zobrazíte seznam funkčních bloků s poněkud tajemnými názvy jako **eq**, **ge**, **gt** ​apod... Zde vám bude nápomocna rozsáhlá nápověda, která je součástí ​Mervis IDE. Na každý funkční blok můžete kliknout pravým tlačítkem a vybrat ​**Nápověda**, čímž zobrazíte popis funkce každého blokuBlok, který hledáme, se jmenuje ​**LT** ​neboli ​**Less than** ​("​Méně než..."​) 
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-21-compare-functions.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-21-compare-functions.png?​direct |}}
  
-Grab the **LT** ​FB and place it onto the **Logic area**.+Přetáhněte blok **LT** ​do **logické sekce**. 
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-22-placed-block.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-22-placed-block.png?​direct |}}
  
-The help for this block says //Output is TRUE if any previous input is less than any next input//. We can see the block has two inputs ​- ''​in1'' ​and ''​in2''​, and one output ​''​=>''​. ​By the logicwe want the ''​heating_on'' ​on to be ''​TRUE''​, if the ''​office_Temperature'' ​is less then ''​threshold_Temperature''​. ​To comply with the block definitionthe ''​office_Temperature'' ​has to be wired to ''​in1'' ​of the block and ''​threshold_Temperature'' ​wired to ''​in2''​. ​The output ​''​=>'' ​we will wire to ''​heating_on''​. ​Wiring is done by grabing the black dot at the input/output name pulling the wire to the dot of the other input/output. The result should look like this.+V nápovědě k tomuto bloku se dozvíte následující: ​//Výstup je TRUE, pokud je hodnota prvního vstupu menší než hodnota druhého vstupu, resp. pokud je hodnota jakéhokoli vstupu menší než hodnota jakéhokoli dalšího vstupu.//. Blok má dva vstupy ​- ''​in1'' ​''​in2'' ​a jeden výstup ​''​=>''​. ​Z hlediska logiky chcemeaby ''​topeni_zapnuto'' ​mělo stav ''​TRUE'' ​pokud je ''​kancelar_teplota'' ​menší než ''​hranicni_teplota''​. ​Abychom vyhověli definici bloku, ''​kancelar_teplota'' ​musí být napojena na vstup ''​in1'' ​''​hranicni_teplota'' ​musí být spojena s ''​in2''​. ​Výstup ​''​=>'' ​pak napojíme na ''​topeni_zapnuto''​. ​Propojení vytvoříme kliknutím na černou tečku u názvu vstupu/výstupu ​jejím přetažením k obdobné tečce u druhého vstupu/výstupuVýsledek by měl vypadat následovně: ​
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-22-wired-block.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-22-wired-block.png?​direct |}}
  
-If you have the correct connectionsyou can **Build** the solution and if the **Build** succeeds, **Deploy** the solution to the controller.+Pokud jsme spoje vytvořili správněmůžeme nyní sestavu ​**zkompilovat**. Pokud pak bude **kompilace** úspěšnámůžeme sestavu ​**nahrát** do kontroléru
  
-If your **Deploy** went wellyou can **Start Debugging**. In the debugging mode, you can see actual values of each input and output of each blockYou can see temperature in our office is 29.625°Cwhich is less then threshold of 30°C and therefor the heating is ''​ON''​ (''​TRUE''​).+Pokud **nahrání** proběhlo bez problémůmůžeme začít s **laděním**. V módu ladění můžete vidět aktuální hodnoty každého vstupu/​výstupu každého blokuNyní vidíme, že teplota v kanceláři je 29,625 °C, což je méně než hraniční teplota 30 °C. Topení se tudíž přepne do stavu ''​ON''​ (''​TRUE''​). ​
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-23-debugging-low.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-23-debugging-low.png?​direct |}}
  
-I warmed up the sensor a little bit and now it shows 30.875°C which is more than 30°C and therefor the heating is ''​OFF''​ (''​FALSE''​)+Nyní senzor zahřejeme (napřjeho stisknutím v dlani). Teplota vzrostla na 30,875 °C; to je více než 30 °C a topení se tak přepne do stavu ''​OFF''​ (''​FALSE''​)
  
 {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-23-debugging-high.png?​direct |}} {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices-23-debugging-high.png?​direct |}}
  
-Also the relay on your UniPi controller should switch ​''​ON'' ​and ''​OFF''​. ​If yescongratulations! You just created your very first temperature regulator.+Pokud jste jako výstup použili DO, můžete na kontroléru změnu mezi ''​ON'' ​''​OFF'' ​sledovat pomocí LED indikátoruPokud jste použili relékromě rozsvícení či zhasnutí LED indikátoru uslyšíte i cvakání příslušného relé
  
-===== Download ​=====+===== Ke stažení ​=====
  
-You can download the whole project here: {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices.zip |}}+Celý projekt si můžete stáhnout zde: {{ :​en:​sw:​01-mervis:​attaching-1-wire-devices.zip |}}