 A počkej je prdůžet na tětelou, musím jistou snažit sbyledit examen a růj nebo jen. OK, to je 1 hodin, proč? Štěpán. Štěpán. Sorry, hej. To je OK. Chynski. Chynski. Ještěpán, když můžete závodit toho, když můžete závodit toho, když můžete závodit toho, když můžete závodit toho, když můžete závodit toho, když můžete závodit toho, když můžete závodit toho. OK, co bychom dělal dnes? Můžete závodit 20 hodin s speciálnou štěpánou, který je závodit pro štěpánou. Ten štěpán je závodit by můžete závodit by můžete závodit by můžete závodit závodit toho, když můžete závodit toho, když můžete závodit toho, když můžete závodit toho. Návodit by můžete závodit toho, když můžete závodit coho, když můžete závodit pro štěpánou. Můžete závodit toho, když můžete závodit toho, když můžete závodit toho. Děkají se, že bychom závodit. Jste překvědat děkali na několikého. a to nevědělo, protože, když jste v těžkém vědětku a máte velmi hodně o elektronického vědětku, to bude hodně, když jste vytvořil něco vytvořit. A velmi hodně je, že jste nevěděli, když něco věděl, že jste nevěděli, když jste věděl, když jste věděl, když jste věděl. Prostě, že jste v decemberu, takže jsme vám něco věděl, takže jsme věděli, že jste věděl, když jste věděl. A bychom povedl, že jste věděl, protože jste věděl, protože jste věděl. Že se v nejvěděli, takže jste věděl. Proste, nezapravilte to, protože to návět. Proste, tady závět. Proste, nezapravilte to, protože... Jak se můžete dát? Jsme děláši. Protože můžete přijít do nejvědětních systémů, když někdo nejvědětný, tak bychom nechává, že bychom nejvědětný nejvědětný, protože můžete přijít do nejvědětných systémů. Hapká stará je Linux a v tenhle tenhle a v tenhle tenhle, protože dánlou program je dánlou. V předtí dánlou, když dánlou, když dánlou, dánlou Arduino IDE, takže dánlou do Arduino.cc a dánlou veliké versiony Arduino IDE. Je to veliké za vývědětní systémů, když jste nevědětný, když jste nevědětný, když jste nevědětný. Arduino IDE je zběžené na Java, ale jste zběžené na Java.js, můžete na Arduino IDE. V něj pošlené. Na čem jsme celem c province? Je tractorp0. Je to v roč. Učíme di tu? Takže v tomhle se vypořadí. Když jste se vůvný měl. Takže se zběžené. Jdu... Ne no, ne no. Ano, ne ne, ne, ne! Ne! Ano, ne ne, ne, ne! Ano, ne ne, ne! Ano, ne ne, ne, ne! Ano, ne, ne, ne, ne! Ano, ne, ne, ne, ne, ne, ne, ne, ne, ne, ne, ne, ne! Vždyť 0.1.0.5 a je 3, což je 4. Někdy nejde, kde je 4. 1,6.4. Je to 1,6.4, takže to je to vytvořilo. Vypravdu je to 1,0. Už jste se vzávající. Je to vzávající. Je to vzávající. Je to vzávající. ...for Arduino library management and Arduino boards management. I am not sure if it works in 1.6... Je to in 1.6... Jedna silviníčka, dobra, to je v pohodě. There is a sum, since 1.6.something... ...there is a lot of new functionality in Arduino IDE. The first is library management. I will speak about library management later, because it will be one of the first things we will do. We will use the library management to download the examples for edušing. a drugé je board manager. I don't know IDE, be open and honest. It's a very stupid text editor. Forget about some advanced, path-like intelligence helping you typing the code or refactoring. No, it's a very simple text editor, like nano. On the behind, there is a whole AWR and ARM compiler stack. So you can compile using the Arduino IDE. And if you download some support for different boards, you can compile and write applications for many, many types of those development boards. Do you know ESP8266 chips? It's a great chip. It combines the microcontroller and Wi-Fi. And this chip you can program in UAL language, in Python, in MicroPython, or in Arduino IDE. And you just need to download the proper support for Arduino IDE, that's all. So Arduino IDE now becomes very, very popular, not just for Arduino boards, but you can use different type of the board with the same libraries as for Arduino. It's very comfortable. So if you run under Arduino, then you can use a lot of kinds of the boards. So, for example, let me check. This one is very popular now, and this one. And you can see here is the same chip on it. It's ESP8266. It's a combination of Wi-Fi and microcontroller. And using the Arduino IDE, the same libraries I'm using for Arduino, I can use the same libraries to program those chips. And again, I'm using Arduino IDE to upload my binary to the chip. Very comfortable, very useful. Arduino IDE supports ARM microcontrollers with cortex M0 and 3 and 4 cores. Very comfortable. You know, to compile and upload. But you will use a very old fashion text editor to write your code. Unfortunately. OK. So, did you download the Arduino IDE? Make it guys, did you download the CH340 driver? OK. So, I am explaining it to you in couple of minutes or seconds. I switch off this presentation because my presentation is in check. But never mind. I will paint. So, what we need. So, we have the microcontroller. And you know, the microcontroller is one electronic piece containing the whole computer inside. In very simple way. So, you have input, outputs, processor unit it's in one piece of the electronics. The microcontrollers really changed the electronics. So, if you take for example a DVD player which is 15 years old you disassemble it and you will see inside huge amount of electronic parts. There will be huge of them. If you disassemble some very new one you will see there just few of them because everything is controlled by microcontroller or is controlled by FPGA, processors and so on. So, it really changed the electronics. Those microcontrollers are very cheap. Some of them are 8 bits, some of them are 16 bits, some of them are 32 bits or 64 bits. Arduino IDE is 8 bit microcontroller. So, it means one memory cell is 5 bits just. But it's enough for us. Then you have your PC somewhere. So, here we have our laptops. So, it's our laptop. Then you need to connect it together. So, I program my code in my laptop or my computer and I need to transfer it to the microcontroller. So, how it works for the guys who doesn't use this style you need a special equipment. This is my camera. So, you need a special equipment. This is microcontroller. This is the same we have on Arduino. It's for Atmel, AVR, 328p. So, it's the name of the chip. The chip can be in different sizes, different packages, but inside is the same. It just can look different style. So, for example, it can look like this. This is the very similar one just in different package. So, you need some special device to upload your code into Arduino or into microcontroller. If you have Arduino, it works a little different way. In Arduino, that is inside Arduino is a small piece of the software called Bootloader. So, Bootloader is a small piece of software listening on serial port of the chip. So, somewhere here we have TX and RX for serial communication. So, this bootloader is listening here and if you switch it on or you restart, you do the reset of the microcontroller. First application which answers the bootloader and bootloader will start listening on the serial port. If nothing happened on the serial port, it starts your application. So, this bootloader replace this electronics. But still what you need, you need to connect this serial port to your computer. How many of you does have serial port on the computer? Maybe some of them use. Yes, because it's still used if you are taking care of the Cisco routers, for example, you need serial port typically. The rest of us, we need something between. So, we need usb to serial. So, we need to convert between usb and the serial. This is a problem. Because, do you have computer? No computer? No, what are you? Sorry, sorry about that. So, you need because we have usual, we are using for communication usb. So, we need usb to serial converter and this is the tricky part. There are just three ways how to do it now. Because you need a special chip or you need a microcontroller which supports this usb to serial conversion inside the microcontroller. We are using with this, the other notes we are using now, they are just simple ones no usb support. So, you need to converter and there are just two vendors, two companies producing the chips during this conversion. The first one is called FTDI. FTDI is used by the official Arduino's. So, to make guys or the Windows 7 guy will have the program, I have some more Arduino's with this FTDI chip, he can replace it. FTDI is supported by the operating system. You don't just connect it, it works. You don't need to take care. The problem of FTDI is that this chip is damn expensive. So, if you buy the original Arduino, there will be FTDI, but the original Arduino cost 25€ or US dollar, something like that. If you buy the cheap one from China as I did, because I paid for my own money everything, then there is no this FTDI chip because it's damn expensive. So, that is chip called CH340. So, this chip is very cheap but there is big support in some operating systems. There is no problem in Linux or almost on every distribution we saw that we had no problems. But I speak about typically the latest version of the latest version of the Fedora. I'm not sure if you have some old fashioned Linux distribution of the maturity of working, no idea. On Windows 10, Windows 8.1 and Windows 8, if you are connected to internet, system downloads the driver, it works. Windows 7, Windows XP you need to install the driver manually and the most tricky part is macOS because there are some changes in operating system in terms of what type of drivers you can use or you cannot use, the drivers must be signed and so on. So, in some versions of macOS it works in some of them not and in some of them if you connect this Arduino the entire system fresh is the kernel part. But it's not a problem, it's a problem of the drivers, it's not a problem of the operating system. You don't even need my firmware Microsoft so I like to lock it to people using the app plus but it's not a problem of the operating system, it's a problem of the driver. It's not signed, no one knows how it's developed so the drivers are the tricky part of the digital part. My recommendation is if you are starting with the Arduino buy some more expensive one with FTDR because then you will have no problems to use it. You get some experience if you have some experience you know how to handle some you know typically if I am using some technology I know the troubleshooting and then if you will need five of them to your home project and so on if you will need one from China if you will need five of them by ten because sometimes it doesn't work and it doesn't have sense send it back to China but for the start I recommend you to buy some nice, proper one and so on for some hobby projects buy this one because from the China are really cheap few dollars cost nothing the original one much better quality but much better price usually I am shopping on eBay or you can shop on Alibaba whatever eBay works perfect for me Questions about connect those devices to your computer when you connect it so the linux guys you will see the new device in devslash tti usb a new serial device very important linux guys you must be a member I forgot about that linux buys you must be a member of the out group because you are accessing serial port if you are not a member of the out group you need to run Arduino IDE as super user because you will not then have access to your serial port almost forget about just connect just connect the guys with windows 10 windows 8 connect to internet connect device and wait for device installation windows 7 who is here with the windows 7 just you no one more je tam adressář windows a v tom jsou drivery the macOS guys just search the internet how to install it sorry I am not expert on the macOS so download the driver try to follow the instruction and try to install it if you will not succeed I will borrow you another Arduino with FTDR chip which I know it works so now on the linux guys new device in devslash tti usb something on macOS it will be the same on the macOS be careful there are some bluetooth devices which behaves like serial port but you will see in the name of the tti bluetooth something and on the for the windows guys and on the windows if you go to device manager so if you go to device manager so device manager so for the windows guys if you go to device manager you must see usb serial ca340 and the name of the serial port if you see on the windows if you see unknown device wait a little to download the drivers or I can send you the usb stick with the drivers right click update device and point to destination where you downloaded the drivers so before we can start linux guys must see this linux guys must see this linux guys must see dev tti usb whatever and the same for the macOS guys so I give you some time to check it if you need help let me know or we have another expert for those chips he runs the trainings for ESP 8266 using the micro python so if you are interested in micro python the guy is yours from the AS you can go to python booth and he can show you a lot of things about that and with the micro python you can do very funny stuff and you can program your favorite python maybe not the old fashion serious pointers this is the most tricky part but no problems just connect it just wait for this and then I show you if you are using the Arduino clone typically it really depends on the micro controller because for example this Arduino this is the Arduino it's called Arduino Leonardo on Arduino Leonardo this chip is atmel AVR AT mega certif2 u4 u means usb so this chip contains usb inside so it's really connected directly to the chip typically for this you don't need to drive it works out of the box but there are some other chips like this quite often use but sometimes you need the driver so for example you have a problem with on one training you have a problem with those devices because the converter here it was not a real converter there was a micro controller similar to this one simulating serial port for some reason on some computers it worked on some computers not and you know the difference was you know same operating system they use i think they use the windows 8 and on some it worked on some not no idea why so maybe you can find that there is some clone of the Arduino using similar chip here or instead of this converter usb to serial there will be another microcontroller simulating the serial port it really worried but the most of most clones you will have from China where you see a340 most of them it's my experience maybe it can change a little in the future because sometimes it's cheaper to buy microcontroller than to buy some microcontroller and of course the guys in China they need to press the problem no no you will connect it because all arduino they have usb port if not i can show you how it looks like so for example i have the arduino yes you have this one it's a very good question by the way thanks so you have this one this is Arduino Mini this one is very useful because if there is just one LED showing you that its power is on if you disassemble this LED using this you can create low power applications running on battery for years because there is just microcontroller and there is no unnecessary electronics around because here this one is very popular too because it's small but here you have this converter for usb it consumes energy and so on so using this one you cannot do low power systems using this one you can do low power system but here is missing this converter so then you need to buy external one and you need to connect it using the cables on the proper pins here this from china the price is 3 us dollars or you can buy the original one from arduino which costs 12 bucks this is the original one from arduino what is nice here that you just sold the pins here or i can show it on another one give me sec it's very important to have a lot of arduino with you all time it's nice that there are no problems on the security now i remember times when i traveled with two laptops and i had so many special security care where is it ah this is nice so this is arduino this is arduino ethernet and arduino ethernet there is snow this usb to serial converter so if you use the original one you just plug it together and that's all so you don't need to use the wires it's only advantage of this one that's all if you are if you are a fan of if you like rapsberry pie on the rapsberry on the gpio header there is a serial there is a serial port and if you connect the converter like this you will have the text console on the serial port so you can control the arduino with any keyboard ssh and nothing you can connect it directly to your computer using the serial port unfortunately some sick mind in in rapsberry community decided that this functionality is default switched off so for the first connectivity units you still need the screens and everything because they switch the ssh by default off too so now is it like more computer than the iot device because you need for the at least for the first setup you need a lot of things to do in the past you just need converter usb to serial no no no no i am using the external one so i am using device like this to connect the rapsberry to my computer so i open the serial console in my computer and i see the text console on arduino i think this this is quite common if you are taking care of some active server active networking devices so i don't do on the sysco it works the same way you connect to sysco router using the serial port and you see the text console from the sysco router in your computer it's very useful i think this one ok does it work for so ok i expect everyone see some serial port from the arduino arduino IDE so as you can see the arduino IDE is just very simple text editor first what you need to do we need to say we need to tell to arduino IDE what arduino we are using and where is the arduino connected so go to tools if it will be in your local language the language you can change the language in preferences because usually it takes the language from the operating system so some people see it in check and it's really strange so you open the tools and we choose the board named arduino slash genuino uno so you need to know what type of arduino you have why because there are a lot of arduino you can see it and for example this arduino use chip 80 mega 32 8p this one use 80 mega 32 u4 and they are not compatible if you are developing if not if you are developing for operating system you don't take care about the hardware physical hardware because it's a job of the operating system there is no operating system maybe on some of those for example on those you can run some version of real time os but those are 32 bits microcontrollers those are to typically those of them many of them are using just 8 bit microcontrollers so you need to know what arduino you have the problem is if you have a wrong arduino arduino id doesn't check it it takes your source code it compiles it push it to the device no one takes care because you know it sends just binary so no check about that you and by the way it's a quite common problem that you do it wrong way you choose the not the right one and then it doesn't work for some of them don't do it just look to my screen so if i choose come on ok i choose this one and see i have arduino mini but now i have another question here what's arduino mini what is the microcontroller arduino mini is using because there are two versions of arduino mini with different microcontroller using this you just say what type of the microcontroller you are using so if you choose the board it means you are choosing the microcontroller type and then the compiler knows how to compile it and that's all now we are using arduino slash genuino uno what does it mean arduino genuino arduino is a registered trademark and there are two owners the one owns the arduino in US and the second owner owns the arduino trademark for the rest of the world so the guys from the US are selling arduino to Europe under the brand genuino it's an open source it's an open hardware but a lot of money there so the guys there were 5 people established arduino and one split and went to US it's a little bit like the same everywhere but there are more funny parts about it one of the last year i worked for pharma company which is called MSD but in US there is a company Merck in Germany but in US the company is called different way but those companies have been one company before 100 years something and after first world war they split it as a compensation the US part as a compensation because of first world war so they use the same name but who cares it's an open hardware company in 40 years but now in the if you have internet it's a huge problem then we need to select the proper port so the guys from the the windows guys you should remember the name of the port on the linux and mac it will be some dev and now go to file examples basic blink and you should see something like that do you see it press the button upload the second from the right sorry second from the left you will see compiling sketch then you will see uploading sketch sometimes the compiling can take quite a lot of time especially if the code is quite big and I think it's slower and slower with the new versions of Arduino IG and you see uploading and you should see green light blinking on the shield this one ok, I want to see blinking glass ok if you have some simple LED it stays there because the LED has another memory and until you have the power it will keep the same thing so if you don't like it disconnect it and connect it back and program some libraries awesome guys, I know how to fix it it needs older version than this one try to search I saw it for the first time and because I am the Microsoft employee for many many years so my knowledge of the Linux it's not so good especially in terms of how to use the different version of the library so how many of you cannot bring the LED problem tells you how many of you are out group or running out of ideas to do that ok, so I go back and I expect every one of you understand the English so if you go and every one of you knows at least a little programming so I think you can very easy understand what's going here so first functions one function is setup one function is loop it looks strange but this what you see sometimes it's called a wiring language it's a just pooled scene nothing else, it's a scene only thing is that the main file of your application doesn't have the main function as a standard C file or C application but it's a scene so all your scenes know that you can use it except some advanced stuff around memory or except the stuff around the memory allocation so no malloc and so on because those microcontrollers they works really different way in terms of memory but pointers loops and everything like that is the same the same data types everything as a C so don't worry if you know C this is the C probably you understand that the function setup is called just once and the function loop is calling again again again and again very simple you don't need here because it's on the back end there is some proper processor takes this put it into the proper C5 is the main is the headers and everything it's in the back end the idea of this is make it as simple as possible if you start to speak about this I can show you almost the same application how it looks like if you write it this out this Arduino functionality and Arduino support so give me sec yes it's if you go to Arduino if you go to the to the folder where is your Arduino IDE then you will see everything you will see different branches and so on but if you want to see what happen with your source code it's probably somewhere in temporary file this is the same functionality you see the blinking LED just using you know the microcontroller and something like this you see here happened on the background in Arduino IDE so your source code is translated to something like this so this happen on the back end so typically in setup you need to initialize your hardware because if you not initialize the hardware the hardware doesn't know about it you cannot use it so if you want to use some pin so it means that really if I show you how is it connected so the green LED is connected to ground the resistor to lower the current going through the LED and you can't using the pin 13 you control the LED and this pin 13 is physically connected there is wire and it's physically connected to something here we can check which one is it so digital pin 13 on Arduino is physically connected to pin 19 and that is really just a wire so using the Arduino IDE we are controlling the power on this physical pin piece of metal and then we control the LED visit on or off so first we need to initialize this pin let build in it's a macro if you will dig into the source codes you will find that for Arduino Uno it's 13 for different Arduino it will be different number of the pin and then you say hey it's a output so we want to write on this pin if you don't do this it will not work because the pin will be let's say switch off and you will not be able to control it so here you need to put hardware initialization so for example the next thing we will try we will try to we will try to use serial communication with Arduino which is very useful for debugging here in the setup you will initialize the serial port for example for communication and in the loop there is the business logic running it again and you can understand write digital high write digital low switch it on switch it off what does it mean high low high means logic 1 and in electronics it's some voltage so what do you think what is the voltage for high it depends on your Arduino some of them are 5 some of them are 3.3 and in other electronics it can be different so for example in your mobile phone i think that the high is something like 1.8 volts so this is the low is 0 be very careful what are you doing because some Arduino are 3.3 volts and those Arduinos will not survive 5 volts if you send the 5 volts to the pin it will not work or you destroy it and this is the problem of Rapsberry Pi Rapsberry Pi is not 5 volts tolerant on digital pins and there is a very high probability that you physically destroy the CPU on the Rapsberry because it's really connected so it's not ok because the macro if you macro cannot control what you put inside so i can no yes you write the proper volume but sometimes you need to read some value from the outside and it can be 5 volts and sometimes you are done this is Arduino one of one this is very tricky Arduino this chip here is Intel Core and this chip contains two cores one is x86 the standard we have in our computers and second one is not a different one it's a quite tricky microcontract but you program it the same way do you see those those electronic parts are called level shifters it changes from 5 volts to 303 the electricity and if i put here 303 here i can have 5 this you can buy this as modules and this one you will need to use for example the Rapsberry Pi if you will use some electronics which is designed for the 5 volts so you need to use the level shifters check is it converter u roviní ok any questions around this so congratulations now you are in hardware world because the hello world for hardware is blinking the LED question oh and quite in the read will you argue no like understand it as a high order because it's not exactly 5 volts there is some you know there is some tolerance and the tolerance is higher it's you know everything between 0 and i don't know 0.2 is 0 and everything more than 3 is 1 so the arduino can handle 5 volt arduino can handle 3.3 voltage logic the question is if you send 5 volts to some device which is designed from 3.3 if it survive or not this is the question but 5 volt logic is compatible with 3.3 voltage logic and if i send a pin to that pin if you said something as input you can read write output is just write input is read write you know it depends on the electronics outside the arduino typically what is the electronics sending into the arduino but you must be almost all arduino are 5 volt tolerance as i know what is not 5 volt tolerance is arduino dual it's not 5 volt tolerance rapsberry pi is not 5 volt tolerance rest of the arduino i saw so you should not have any problem but check it because there are so many arduino so maybe i don't know all of them so you can find some which are not 5 volt tolerant and you need to think about it ok ok sorry this is in check but never mind so we started to bring with the led led is here this one and this arduino shield you can do a lot of things it's really designed that we can teach using it almost everything what is possible to do this arduino so what do we have here we have some leds we have a led which is called rgb led so it's a one led these three colors inside so you can mix the colors we will do it today we have a button button is connected to interrupt so imagine you have the loop you are doing a lot of things in the loop then you need to react immediately on some input for the user so you need to use the interrupts so button is called to interrupt then we have the light sensor on the right side and there is a and one more center it looks like a small drop it's a thermo resistor it measures temperature how is it calling? it's a thermometer but you know it's a resistor changing the resistance depends on temperature but very very lot of course every resistor is depending on the temperature but this one a lot this can be replaced by another type of the temperature sensor then we have here real time clock real time clock is connected to I2C bus you can see the battery taking care of the that the clock is still running there is a display and the display is controlled by another microcontroller and those pins on the top there are six pins here using these six pins you can program this microcontroller again you can program the microcontroller using IDE so inside the microcontroller is a firmware controlling the display for example we can now it's designed that we can replace display with something else for example another display but in the future we can have a shield for a shield and so we can teach a lot of things including creating your own firmware uploading the firmware to the microcontroller which is not connected using the USB so you can use some programmer and so on so it's really designed for education we hope it will be successful and maybe we will try to put it in the Diego Kickstarter to get the resources so now try to use so now our LED is blinking so everything is working for us so now please go to sketch go to include library go to manage libraries and search for edu shield maybe yes this is the new functionality and all examples for edu shield we are provided in this way if you can use this one you can search for edu shield on github and you can download everything from the github because we are operating in the seasonic and as you see the seasonic believes in open source so hardware is open source all examples all documentation is open source unfortunately the documentation now is just in Czech we need to finish it first in the Czech then we will translate it to English and we hope the community will translate it to another languages ok just install it that's all using this library manager you can install the libraries for almost everything so how it works so for example you need to use or how i manage the libraries i decided that i need to use some whatever i want to use where is it ok let's try this one now it's a good example let's go another way so typically if i want to start to work on some project i think what sensors i will need and usually i go to this web page it's adafruit.com and something is wrong with the adafruit.com it's not adafruit adafruit so i go to shop there are some sensors and i want to measure light core photo so i want to measure luminosity looks light sensor for example this one as you can see the price is almost 6 us dollars then you need to pay the delivery from the US then you need to pay VAT and the incoming tax so the price will be like 20 us dollars not maybe 15 so it's TSL2561.1 so then i go to ebay and for me it's important the number of the electronic part which is used here i don't take care who producing the module there are many producers of this module the electronic part on it this is the important thing i am missing the T sorry guys much better price and it's for free so i have my sensor then i go here i search for the name of the chip then i can choose library which is the proper one or all of them test it and that's all the all libraries are stored in your home directory so if you go to your home directory you will see there a probably new folder called Arduino there is libraries and here are my libraries so here you can see eduShield library because i install it this way and eduShield library doesn't include any real library we are providing this way we are providing the examples so if you download the library the documentation is provided by examples so now if you go to file examples and you go somewhere down you will see eduShield then you can open the blink and you will see something very similar but instead of built in we use the number of the pin here the same way as the example you saw before and give me sec i will scroll down here now here so what do you have here so the green LED is connected to number 13 yellow LED is connected to number 1011 what is the number? guys i need glasses what is that? it's 8 the name of this pin is A2 name of this pin is A3 it's a macro in C nothing else so if you do this example if you put instead of 13 you put A2 you will blink with the yellow one sorry A2 is the red one A3 is the yellow one so see i am blinking with different LED that's all so how to do if you want to blink all of them in setup you need to initialize all of them then you need to control all of them in the loop and depending on where you put the delay where you put digital right high digital right low it will blink in different style that's all as you can see here in micro electronics typically everything is controlled that you are setting high and lows on some physical pins on microcontroller of course in microcontroller have some special circuits doing digital conversion for example digital or analog to digital conversion we will do it later but it's quite simple for example using this you learn already now so you know that the delay will stop the microcontroller for some time and so on so using the things now you can create some automation very easy if you go to any factory that you have the robots doing something in many many cases it's just that sending the signal in some sequence controls some devices and it's just digital right wait easy way this is the easy way how to control some machinery for delays you are using the analog ones it never marked if i go back here this is the microcontroller so we are using some analog one so we are using this one analog input analog 2 input analog 2 is pc2 pin this is the name of the pin and this pin has two functionalities analog and digital for example no ok you say it in setup you say hey i will use this pin as a digital yes it's output if you say it's an input it's by default for some pins it 0 or 1 but if you say hey it's an output input on analog it will automatically switch on analog to digital converter 2.3 no no no it doesn't work you need to use the different way i will show you how but in some microcontroller i understand your question so this one you can use just reading the analog values if you want to create analog value you need to use a different microcontroller including digital 2 analog conversion they are existing of course but they are typically more expensive or you can use a different technique which is called pull width modulation so you are sending very quick some signals and using this you can control how much energy you put outside but this one works with lights it works with electric engines but it probably sometimes doesn't work with different types of electronics which expect a real analog value ok so you will see this some of them you will see later those techniques so delay is infinite loop running for the time you need so it's it stops running your application but the microcontroller runs on full power if you want to put microcontroller into sleep it's possible you need to use a library for this the name of the libraries is avr slash sleep.h this is the library and almost all microcontrollers on rvios are designed for low power so if you know what you are doing you can extremely reduce the consumption of the electricity of the power on the microcontroller so the simplest way how to do it the peripheries you are not using you switch them off if I know that I will not use the analog to digital converter this one consumes maybe 40% of the power of the microcontroller you switch it off if I know I don't need to use SPI I switch it off so you can really reduce the power microcontroller then the microcontroller contains different sleep modes you know how deep you send the microcontroller into sleep there are some sleep modes if you want to wake up the microcontroller you need to restart it because it sleeps so deep so all memory is gone everything is gone you need to restart it in another sleep mode it can wake up based on the timer so after some amount of the time what we can what we can teach we will not do it today because not all demos are ready now but there is a real time clock and real time clock can create the square wave so for example it can sense every single second a signal so you put Arduino you put the microcontroller into the sleep and you wake up it based on external interrupt and the external interrupt can be button external interrupt can be for example the real time clock so everything like this is possible to do on Arduino using the existing libraries and using the knowledge of how it works but it's possible to do it this is very critical if you want to create some device running on a battery for a very long time so everything must sleep and you must wake up only when you really need to do something and then go to the sleep unfortunately the problem of the Arduino we can I can show it on this one the problem of the Arduino you have lot of electrons here you have the LED you can see this LED here you see the red one it tells you that the Arduino is powered the consumption of LED is 2.5 mA 2.5 mA it's a huge amount of the power it consumes if you want to create something low power you must work the consumption must be less than 10 mA this is the low power ideally less than 1 mA it's possible to do it but the electronics must be ready for it the absolutely worst thing you can do if you want to do something low power where is it it's not visible on this one give me sec I need to find this one so the worst thing you can do if you want to do low power application you take the Arduino first the LED will consumes a huge amount of the power 1.5 mA is too much lot of people are using this connector to fit Arduino because using this connector you can use something like this which is cool life 9V battery I can connect it directly very nice the capacity of the do you know the capacity of the 9V battery 250 mA it takes 100 hours to drain it just using the LED for days it's a big problem first problem but it will drain down probably in couple of hours because if I connect it here this is 9V I need 5V we have to put the 4V let's make a heat from it so this one is linear stabilizer it creates from you can connect here anything between 7 and 12V and this piece creates a 5V but everything is it changes to the heat so it's very very energy efficient there is a pin called VIN again it use this one or there is a 5V pin so you can create you can feed it directly for example for battery so if you have this AA batteries you put 3 of them together you have almost 5V and you can use it it will work and you can save some energy that you don't use this one so for long running applications it's much better to use the Arduino test everything then you can take this chip out and put it to your own electronics which is designed for low power the low power is let's say very special discipline of electronic design and of course you need a special electronics for it and your application must be ready your application must be ready for low power if the electronics is not ready you cannot help it with the software if the software is not ready the best electronics will not work if the consumption is the same as if you use this VIN or the USB yes let's say if you put it here this piece which creates the heat and waste the energy is used only if you use this connector or if you use the VIN here so you can use you can power it for example you can put here a power bank to feed it but some power banks are designed by how to say it in a proper and correct way not smart people because for example this one when is it operating there is an LED 2.5 mA waste or nothing the capacity of this one is very low I think there is just one cell inside but 5 mA it's almost nothing and they waste a lot of energy just with the stupid LED and you still have to 5 volts to have 5 volts for you yes and sometimes you can buy a super smart power bank if you know the consumption is not enough power bank switch off so it's funny too because if you are working on the low power design and you cannot feed it with the power bank because power bank thinks that hey there is no device the consumption is less than 1 mA there cannot be any device this is very tricky this is a very tricky part and in my job it's a big problem because I'm responsible in Microsoft I'm responsible for IoT solutions as architect in Central East Europe and we are getting a lot of requests that they need the customers or partner they need to run some devices on the battery for a very long time and then we need to help them to find the proper company who knows how to create low power hardware not just the hardware but the software but the software too so it's not easy so let's go let's go to the next example now we will speak about serial communication if you are using the Arduino it's almost impossible to debug it in the way you usually use to debug the software so you cannot use any breakpoints step by step running the code because the hardware typically is not ready for it it's possible to do it but you need a special equipment so even if you are using a bit microcontrast if you have the proper equipment you can do typical debugging your breakpoints looking into the variables but it's not possible on the Arduino so instead of this we are using serial communication because your Arduino is already connected to your computer and the computer sees Arduino as a serial port so you can use the serial port to sending data from Arduino to computer and of course from computer to Arduino sometimes it can be very useful for you because you can use Arduino to measure what you need and using the serial cable or USB cable in this case using the USB cable you send data to your computer inside your computer you can run the job reading the data from the Arduino so internet to process it with machine planning somewhere in the cloud so very easy Arduino can be used this way another very nice thing using the serial communication is to use it with Bluetooth so what you can buy again i switch off my camera you can buy this module and this module is a Bluetooth module you connect it to serial port so on Arduino you have the serial port on the pins 2 not just on the USB so if you proper connect it to this to Arduino so you can send data to bluetooth module and you can connect to bluetooth module if you don't have iPhones because iPhone if you are not a blessed developer with the iPhone you can develop just for bluetooth 4 if you are not a blessed developer you cannot use this simple stuff because it's a bluetooth 2 if you have the windows phone if you have probably android you can use it and then you can very easy connect any sensors to your mobile phone and you can very easy combine information from the sensors you have a lot of sensors inside your mobile phone you can combine it together and again you can do a very nice stuff special using this technique many years ago I measured for journalists the vibrations on D1 highway so I had I used the Arduino getting information about the noise I used the phone using the accelerometer and GPS and we measured the quality of the highway we did it before the reconstruction started then the journalists did it again with the with the better technology because it changed a lot so they did it I think the last year and they plan to do it after the reconstruction it will be complete and they can say hey they really did it or they did not so you know it's like this data journalism combining the hard data with the story of the journalists and we use the very simple technology and the easiest way how to connect device like this is my mobile phone bluetooth module for 3 years dollars very nice and again it communicates with the serial port if you want to use GPS with your application GPS communicates using the serial port if you want to use if you want to connect Arduino to GSM this is the GSM module antenna SIM card here you can connect audio so you can create a you can put your own mobile phone by the way from using the Arduino and this shield and again it speaks together using the serial port even your super fancy Samsung a 7 edge contains some CPU SIM think like this and it communicates using the old serial port how many of you remember the 80 commands to control all the models that's the time sending SMS it's 80 commands 80 commands are from 60s still works and we will use it probably next 1000 years so serial communication is extremely important so please and you will see how is it easy so now we go to file examples edu shield and there is serial communication example and the serial communication example as you see is very simple set up as i told you in set up we need in set up we need to set up all hardware so what i am doing i say ok hey serial dot begin 9600 so i am switching on the serial communication is the computer serial the object serial is always communication with your computer on some Arduino's you can have more serial ports and the name will be serial 1,2,3,4 up to 5 on Arduino Uno you have just one hardware serial port what does it mean hardware serial port inside the microcontroller there is a special circuit special module taking care of the serial communication because serial communication must be the signals must be very precise because it really sends the signals like 001 switch it puts the 0 or 5V 05V and based on these signals you can decode it as a bytes on other side so it must be quite precise because the problem of the serial communication is that the both parts of the communication must know the proper speed of the communication there is no hand shaking there is nothing hey now i am running on this speed and the guys on the other side understand say ok, i agree with this speed or no, it's too fast for me, let's go little down nothing like this exist there i know my speed and the opposite side must know about it so we are setting speed to 9600 it's in bits per second it's not bytes per second it's bits per second you cannot choose number what you want because there are some in theory yes but there are some numbers there are some speeds and it's very easy you just need to remember one speed it's 1200 and then the next one is 2 times more it's 2400 4800 9600 a so on the speed can be in theory infinite but if you have a traditional serial device the maximum speed i saw and i used was 15500 this is the highest traditional speed for the serial port but it can work much more faster if you connect those devices it's a ESP8266 and when you flash a new firmware inside the speed is very very fast but uploading the software is 15100 15500 but uploading the firmware the speed is 4 million something like that bits per second but in traditional way 15500 is the maximum i saw but it can be much faster ok so we do initialization and what a surprise serial print it sends the information from the Arduino to my computer and here in my infinite loop i am asking hey what is available on serial port something is waiting on serial port it returns the number of bytes waiting for processing i read one byte i converted to i read it as a hard and i say ok is it 0 i switch the green LED on if is it off if is it 1 i switch it on if you want to get the serial console you don't need to install anything it's included in Arduino IDE so please now go to tools open serial monitor keep it open the Arduino IDE is now smart enough to disconnect it before uploading it was the great feature year ago do you know how Arduino is old 15 was 10 years so it's now almost 12 so and upload it you see it's not available now because it's disconnected great feature by the way check this one here the global variables use 2012 bytes 10% of dynamic memory leaving so the operating memory here is 2 kilobytes and you know it's a we got a couple a couple of requests from the big somewhere houses if you can do training with the Arduino to the developers because they need to learn how to work with this amount not to waste the memory think about it and here believe me or not the difference if you use the integer or short or byte it really counts by the end of the day you know it's a typical question ok we have four doors here how many bytes you need to transfer if you want to say the status if is it door open or close or window open or close one you need four bits so if it's one byte or eight doors think about that believe me or not many people will use if they will be smart they will use four booleans maybe four integers one integer is for bytes in our computers ok and see if I send ok we need to make it more interactive so if I sent now send one and the magic is zero zero you see it's very simple and now you can control something very easy instead of this LEDs you can connect their relay you can control opening of the garage for example computer you can connect to internet so everyone will be able to open your garage if you do it wrong very simple functionality I can't communicate with the computer or with the mobile phone if I choose the bluetooth device if I connect the bluetooth device by the way if you want to connect the relay to your Arduino it's possible to do it but between the relay and Arduino it's good idea to put some more some electronics so you know really disconnect the Arduino from the power power so some auto coupler or at least the transistor or stuff like that any questions around this what you can try so now you see my speed is 9600 and let's say look how woke is this text so if I make it like 2 times higher you will see that the text will be longer because every single bit is read twice because I am running on double speed so if typically if you see that something like this is going from your serial console you are on the wrong speed because typically the protocols using the serial port are text protocols for example GPS have you seen the protocol for GPS sometimes by the way GPS protocol is very very old too so this is the GPS protocol the data going from the GPS and we need to process them so you know that the start of the sentence is dollar sign and of the sentence is the new line and this is what you read from if you connect the GPS direct to serial port you open some serial console you will get this data any questions yes now no you cannot do it so for Arduino Uno if you want to connect the Arduino if you want to use some serial device do not use Arduino Uno because the physical hardware serial port is used for communication is the computer you can emulate you can use the software emulator for serial port sometimes it works, sometimes not it's not a good idea so what to do if you want to play this serial for example you want to use the GPS just GPS, nothing else it's better to use Arduino Leonardo it's almost the same price as Arduino Uno but the serial port which is here on pins 0 and 1 use the physical serial port on the chip but the chip is connected using the inbuilt usb functionality so this one is truly free so serial port, object serial on Arduino Uno goes to computer and this one is separate one called serial one or you can use the big brother the big brother this one it is Arduino Mega or Arduino Mega you have 4 physical serial ports you can use serial 1, 2, 3, 4 it's cost 2 times more than the approximate this one cost on ebay 400 from the official one cost around more than normal or if you use some Arduino not using Arduino which is not using the A bit microcontroller you use for example Arduino with this Intel or i have Arduino with where is it too many arduinos this one it's nice that my wife has no idea how much does it cost you know it's the same for me if she come with the new shoes she tomato the price was 300 i believe it i have no idea what does it cost you know 20 grams this one so the microcontroller here is some 10d yes it's some 10d 32 bit microcontroller with cortex arm and zero core again it contains there is a support for usb so you have one free port unfortunately i don't understand why they don't use the more port because it's cheap it can handle i think 8 8 physical set of controllers those microcontrollers are very very powerful they are full of them be careful Arduino do is not 5 volt tolerant you use their 5 volts just once time ok yes maybe there will be no at least maybe it will be without yes maybe no magic smoke ok so serial port so what time do we have we have one more hour i think you don't need any break nothing like that it's not necessary i can survive you can survive but unfortunately i am trained because it's my job to speak to customers and doing the trainings ok now we will try the RGB LED you can find on the right side and you see it's connected quite a strange way the RGB is connected to 5, 6 and 9 there is a reason for it you can see if you have the Arduino i can show it here on Arduino you can see that you have the name of the ports it has this tilde sign lovka and it means that on those pins on those pins give me a sec we can move it a little oh give me a sec and this means that on these ports also on these pins you can control how much energy goes out so for example if you need to control the revolves of the electric engine you can control it using those pins only with this tilde there are just 6 of them do you think can you connect directly the electric engine to Arduino? no yes you can just once be very careful, special there is in English it will be in English induction load if you have something with coil inside if there is something with the coil inside you send energy there and it moves you stop the sending energy like electric engine it is still moving and it produces electricity and this it doesn't produce a high voltage but it can produce a very high current you know it makes the backflash or how's it and this definitely destroys your electronics so if you need to connect the relay there is a coil electric engine to use something between your Arduino and this type of load there are special items so for example if you want to control the engines the electric engines you will use something called H bridge H bridge is a special piece of the electronics for controlling the revolves of the standard electric engine I was really surprised we have in Czech Republic for those who are not from our country there is when I was a small kid there was a very extreme popular magazine about techniques for kids called ABC the magazine name was just ABC model was more for building the models this one was like the popular you know more popular you know they explain everything for 12 years old kid there are a lot of you know stuff you can try to build a very nice one I love it here I bought this magazine again because there was the there was the series about the Ardino so I was really curious because it's my hobby I have two hobbies Ardino and cooking if I am not running the Ardino trainings I am cooking some so and there was this schema like this this engine just connected directly to the Ardino if some small kid do this this there will be no more Ardino because the electric engine definitely is strong strange for me so how you can control how much energy you send outside the one way for some loads you will probably need a special circuit inside called digital to analog converter on some Arduinos it's available so you can really say ok on this pin I need 2.25 volts it's available on some Arduinos on almost all of them it's not available so you are controlling the power using the technological PWM it means pulse width modulation it means that you have some frequency which is called duty cycle we will use the basic function to do it where the frequency is 1 kHz java I hate this it's from Arduino ID so the duty cycle is some frequency which is 1 kHz or we will use it as a 1 kHz which is quite common frequency or there is functionalities so you can create any frequency you need but the basic one which is usually used is 1 kHz and inside this duty cycle you control how long is spin on high so if you want to send 2.5 volts outside you will keep it up the half of duty cycle and down of half of duty cycle in theory it creates 2.5 volts you know very quickly sending changing this one the opposite side to the type which will work with this if there will be some special electronics which really needs 2.5 volts this one will not work probably because it can be the opposite side can read the voltage quicker than 1 kHz and it will be able to read 505050 and it will not see it as 2.5 volts if you take a standard voltmeter if you put there a oscilloscope you will see this this is the easiest way how to control the output energy but imagine that you have a pin you need to switch it on off very quickly and in very precise way you cannot do it inside your code so again inside the microcontroller there are special circuits doing this but those circuits are available just on some pins so you need to use just 6 pins on Arduino Uno support this technology if you use another pin you will see just full on zero and nothing between it doesn't work there is one more thing I want to tell you there are special pins special circuit the load must accept it ah ok I know in the do you know first one you can split this up to 256 steps so it's not you know let's say you can control it just one byte so if the precision is just one byte here the precision technique is used to control servo engines do you know the servo engines? probably you saw it and the servo engine works that the duty cycle the length of this is 20 milliseconds and if you put it and it measures how long it is up and it means the angel so zero is zero ah 1 millisecond 1 millisecond 1 millisecond is zero degrees 1,5 millisecond is 60 degrees no 60 because it's from zero to 120 degrees it's a standard servo some of them they can move more but the standard servo is zero to 120 so using this using this style you control the servo for example so it's very important but if you want to control servo there is a servo object surprise and then you say ok 60 degrees or 25 degrees and it does it it's very simple ok so please go to Arduino IDE file examples EduShield rgbpvm two things for you red green blue this is the number of the pins red is a you can instead of red yes 659 6 ports pvm you set it as output nothing blue for you and now you see i put here digital write high but you will see it will go see here it looks strange there is the you have if you have the rgb LEDs you have come on cathode or come on anode so sometimes high for LED sometimes high means that it's off and glow it is on it's better this reverse intelligence is better for power consumption and analog write analog write means ok i am writing analog you know it's all analog it's pvm which pin and we go from 255 we go to 0 ok so 256 if you run it you will see the color will change and you say exactly this techniques this is exactly the same if you need to control the speed of the engine but between the arduino and the engine will be some electronics which is able to handle you know the high current going through the electric engine i don't know if it will be visible on my on my you can see it somehow on my camera the colors are changing some question for this ok the last thing we will cover two things we will cover button and we will cover analog input ok so i see it we will have like next 30 minutes and then we will have some time for the questions we can discuss your problems so traffic lights traffic lights it's a very common you know exercise for micro electronics imagine you have the button you are pushing the button and you want to cycle the traffic lights red red together with the orange green and so you are cycling the traffic lights so leds are clear i think and what about the button how does it work so you see the button is if i press the button typically button if i press it it makes the shortcut here so if i press the button button is connected to pin number 2 why there because pin number 2 supports in paths so if the button is connected in the value you can use the input so if i press the button i read here zero voltage because you know you see here is the ground press the button shortcut i read the zero voltage here what voltage i read here if the button button is not pressed what voltage i repair ok we are in the school so you need to answer absolutely precise 5 i accept 4 small kids not for you here is 5 volts but here is yes defined by divider here is some lost but of course you will read something very close to 5 volts so you will read here digital 1 how is it work if you connect the button in the wrong way you do not work because the problem is here i need to read zero or one if i avoid this if i press it i read the zero here is the shortcut it is clear connect it to typically to to voltage you are using to feed the device you will not able to tell what voltage is here because it will fly somewhere in the air so this is very important and if you will learn maybe i hope i don't like to inspire people i like to teach people i hope i inspire you that you will try to argue at your home to start play with it because you can do a lot of interesting stuff if you will start learning this Arduino you will read about something called pull up resistor this is pull up resistor it pulls up to high voltage something and the electric is very easy here if i press the button here is zero ohm and everything in nature wants to have the lowest as lowest by energy as possible so the electricity it goes here if it is not pressed here is the infinite resistance so electricity goes here because pull up resistor is much bigger than zero and is much lower than infinite this is pull up resistor sometimes you will see pull down resistors so it works different way but typically the pull up are used much more often sometimes you will see the circuits circuits without this pull up resistor why because first it is cheaper and it is easier to design it and the second inside microcontroller you can switch pull up resistor on using the software because the pull up resistor is inside for every single pin every single digital pin there is a pull up resistor and you can switch it on using your software so there are two ways how to do it and of course you know the fight VIM or IMAX OK, who is the VIM or worse, no no so this is the same here pull up resistor must be physical or pull up resistor can be inside fighting each other do you want one we will come back the people who are more involved in electronics their problem is the pull up they have the problem with the integrated pull up that they cannot calculate the proper value because there is one fixed value and if the people designing the electronics they are crazy the same way they are typing the software so they want to calculate everything properly and sometimes you need this size sometimes another one and if you use the internal one there is just one you cannot change it let's say this is the the very mental problem in the people yes so this is the one the problem to calculate it you cannot change it and so on and in few no no no it's very easy you go to data sheet of the microcontra and then you will see the input pull up size is and don't worry you will see another fight between the electronics and the software in few minutes please go to examples then we go again to data shield and there is a semaphore tlačitko you need to switch it it's a as i told you the semaphore is a traffic light it's a very common it's a very common exercise because using this you can create something called state engine so you have defined state of the system that is the logic switching between those states so here i have the states stuff means state we need to translate the source code to english too so we have four states for the lights that is the logic new state i need to ask my friend why he used the mixture of the english and check this is the state engine this next one is that and so on it's cycling of course you can do it a different way you can create the circle array using the shifting the bits in bytes and so on this is much easier to read for common people which i usually visiting and the logic is very i read if the button is slow if yes i change the state and why i am waiting until the button is slow you will try it means try to delete of the next three lines so you will try to delete it you will see what happened and if you this is the very easy way is it digital read, i read the button is defined as djs input which is new for you and the loop is so fast the loop is going so fast so it can very easy you know read you will be very quick you will try to push it as quick as possible this one is much faster than you much much faster so try to upload it and test it then you will speak this section now try to delete those three lines it is broken but you know i mean the values now the values are slow because if you if you push it if it is not pushed it goes up to high voltage if you push it it makes a short cut to the ground so only if it is pushed it is false it goes 0 but this is the common behavior of the button of course you can change the physical circuit that the push can be high it is possible to do it but it is not common common is this way this is the common way how to connect it so what happened if you delete those three lines yes because the loop is so fast that if you press it and release it the loops goes many many times so sometimes you need to avoid this situation and you need to really read just one push things like this can avoid in Czech is it called zákmit in English it will be how to sounds bounce thank you because inside the button there is a small průžino spring bouncing and for every button it sometimes take a very very short time to stop bouncing but the time for you cannot measure it or you cannot see it but the loop is so fast that it can happen so if you want to debounce the button debounce debounce the button you need for example read the value wait a little and read it again if the value is the same so you have ok it's a really button push or you need to wait until someone the button release and it's called bouncing sometimes the bouncing is done on the level of the electronics and it means that you use the capacitator next parallel to the button and you know the capacitator create the change make smooth not the bouncing but making smooth and again there is a fight capacitator or somewhere Vim Vim or nano ok with this knowledge for example now you can do imagine you have green house and you want to create you want to push button and open the windows push button and close the windows now you know how to do it you know how to use button you know you know how to control the speed of electric engine and the button is very very important sensor now we use this sensor as a user input where to use the button which is very important sensor using the button you can say you can create some borders for something which move when you finish here go and ask the guy with the 3d printer and he will show you something called n stops on the 3d printer which tells the 3d printer hey here is 0000 so there are 3 bumpers for each axe and it's very simple the server says ok run the engine in the direction and the engine goes until something touch the button and then it stops so if I want to open the windows I will have one blow button to activate it and then I have 2 n stops to say ok it's fully open it's fully closed and you don't need any special electronics just small piece of the software inside and using this the n stops timing or stops something typically it's used in PLCs you know it's PLC it's an industrial computer PLC is a special computer controlling the machines in the factories it's called PLC those computers are extremely well designed because there was you don't want any failures in the factory because there's a lot of money and typically PLC just know there are some n stops and say run this engine until button is touch then run this engine until button is touch very easy and if we speak about the greenhouse we can try to measure for example the light you want to open the greenhouse when the suns go up you want to close it where it's dark and for example we can use this one it's called photoresister photoresister measures amount of the light which is very important it doesn't tell you you know the unit for light is looks it doesn't tell you how many looks you have inside probably you can calculate it somehow but it tells you some auto flight some amount of the light so what we will do we will do very simple exercise if there will be a lot of light it will be green if there will be less light it will be red so very simple measuring of the light nothing you know no record working signs but using this you can for example control using this you can control in the fridge for example because typically in the fridge we have this so ok you know let's speak about this if you look here it's the the circuit is very similar to push button it's very similar this is the this circuit here this part is called voltage divider the high voltage low voltage 2 resistors and based on the value of those resistors you measure different voltage here this voltage divider this voltage divider it cannot work ok basic circuit you can see how to calculate everything in sound probably you did it in the school but you just don't remember but believe me you did it only voltage divider definitely you did it so here we need to measure the voltage the voltage will be between 0 ok we discuss it like again wrong answer for wrong answer so what's happened here we have there are 6 special inputs which allows you to measure the voltage so those 6 inputs are connected to special module inside the micro electronics which is called analog to digital converter analog to digital converter works very simple way here is the voltage and here is the output the output is 3 bits output and 3 bits output means 0 to 7 yes so voltage goes up and it's still 0 still 0 now is it 1 goes up, still up now is it 2 and so on so in our Arduino the voltage divider analog to digital converter is 10 bits so it means from 0 to 1020 0 to 0 how much voltage is 1023 how big voltage is it we know the 5V is wrong answer it's the it's called the 1023 voltage is analog reference voltage how big is analog reference voltage it depends so there is a special pin on Arduino where you can connect some special electric power called analog reference source this produce extremely precise voltage extremely precise so if you can buy for example 1V and it will keep 1V very very very precise usually you don't use it so the analog reference is equal to to input voltage how big is input voltage if you use the USB you hope it's 5V if you use the battery you don't change in time so if you are using if you are using analog inputs if you are using analog sensors the precision heavily depends on the quality of the analog reference so you can use those just you know somehow not for very very precise measurements ok so let's try it so the last one for today then I will start cleaning card we can discuss it outside because the next one start in when we have 3 hours I think it should be 3 hours so just check it so I do shield and then we have full light scale ok we have enough time for the questions perfect no problem so what's new for you see analog read it reads the value from analog to digital converter which for us is between 0 and 1,023 then I print it here there is a very nice I do it because there is a very nice functionality if you go to tools there is a serial plotter and if you send a number just a number to serial port it plots a nice chart very simple one another thing which is new for you which is very useful is function call map so I have value I read some value the value is I do some measurements also I know that the value is typically between 200 and 800 but I have just 3 leds so I need to map it between 0 and 3 you know you have 2 scales so you have number in one scale and you know to know where number will be in another scale this is done by function of course you can calculate it using trojčlenka in check no idea how to say trojčlenka in English so if I open serial plotter you upload it to the device and of course I expect you have some light ok maybe you have some you can use your phone as a light uploading uploading uploading wrong speed see it goes up and it creates some I think maybe there is somewhere that the analog is 0 so it creates something like this and if you change the amount of the light you will see that the leds will start going switching on and off and so on again using this you can control a lot of things by light so for example really the sun is up you can do something it's a dark quite nice implementation so the delay of processor is no problem the processor is super fast the problem is delay of analog digital converter which is super slow compared to speed of the processor you need to buy external analog to digital converters with low latency typical on those 8-bit microcontrollers they are fucking fast because you know it's very efficient there is nothing running inside no operating system but the analog to digital converter is slow because you have just one analog to digital converter for 16 volts so this is the reason why it's slow and I think on you will find it in documentation but I think it doesn't have sense to read more than 100 times 100 times per second from this so 100 times per second if you want to take a picture of flash for example I think it's too much as I know not in this microcontroller maybe in another ones maybe you can stop the multiplexing but you have to take the register directly just by reading the data sheet probably yes maybe it's possible I have never done it usually I switch it off because of the power consumption because the the red analog to digital converter it takes a lot of energy ok so do you have any questions it's all I want to see to show you today I have still 30 minutes to go so we can discuss it I have a lot of devices we can try another stuff if you want change the mapping change the mapping so maybe move this one not 200 change it to something give me a sec red is give me a sec 0 red is so the red should be on there is missing one so make this one lower make this one lower because still if you put it for example a finger on it it sounds like those those through your finger make this one make this one lower you know to move the scale a little or you need to fix this one you can see here is the missing scale for one ok so the one and the all there is wrong logic sorry and the logic is strange I didn't wrong this people I need to fix it there is some something strange is there I need to fix it I am more concerned about the text I need to check it there is some error in the code no the code is fine I see it in the quarter the value goes down when I hide it and then while I keep it hiding it goes up again now there is the delay not much too much light I am thinking why there is the zero there is less than 2 which is 1 and there is less than 3 which is 2 so I think that does not write by which zero ok ok I do this one no the question is why it shows the zero I show the monitor let's upload it this way why does it measure the three three is wrong number I know because we show here the value after the conversion this is the reason see there are two times set out print so if you delete the second one it will create the proper code on the chart because I showed what I read from analog then I show where is it on the scale and it means the reason why this goes down the number print is what is all those lines across but there is a spike going down but maybe it shows my heart no no no the spike is here because I test for zero but here I am testing less than 2 so it means 1 and 2 so no because this is just about writing to those lines and we don't care about that I am worried about the analog print I need to see kdy to zplane do za sní to zplane do a vlastně nezubit jo jo to může vej tu stále to bezispomně že on může a teplová šíruky možná ten jsou já nemůžu přesnit no to závom můžu mít jo můžu mít prostě si nějaký závny teploto bezispomně to být to že je tě fakt, že když to nedělám rukou jo tam může být s faktorne že tam to teplou takhle obecně všetký rezisto že jsou nějakým susencí kdyby na teplotu je možná, že ten poto rezisto na to taky nějaké a vlě jo a škoja, že tady někdy hledá na tím malý protože ten ditonali tady je první vědě jo, ale může tam být nějaký vlědný může to sě řádná výzikám vlastnost jo, ten poto rezisto můžeme, že když jste z Brno a jste těčný a jste výzikám na nějaké díky tady můžeme vlastnosti, když je vlastnosti na 25. február tady jste, že jste z Akademije s Zetniku jste zvukovat A když kdořešte do cZ, když jste na akadémie cZ, kdež jste na akadémie cZ. A jsou tam pořád nějaké volní místa. Par bych tam ještě mělo vejt. Vždyš, že vstvíš cZ způsobního projektu je svoje dělávalo, schopnit dělávala, přednit štefom v Čepěčku. Proto v To je nemožné, protože jsou třeba 300 píci. 50 píci jsou k tomu, když jsou v Čina, když jsou třeba třeba mikro-kontrollers, když jsou kontrolené. Takže jsme musíme vzítiť to, a tady se Zetnik vzíti, vzíti to z vědělávací, povědělávací, povědělávací, povědělávací. Co je robí vědětnou? Co je robí vědětnou? Co je robí vědětnou? Super, dík. Jako mnoho většinou, s linuksem těch lidí máme velký minimun. Tam jsou většiné problémy s mekařem, a tady v tom jen sluchují. Když těch nám na tyk akci chodí výrazně víc. Ale když karto školíme přes Zetnik, takový tam jsou připravený, bol testovaný počít a čes a kumprázk. Takže tam to naštěstí nemusíme řešit, no. Ale dobře robí vědět. Já si to mám, jakáma čeče, si to mám, já si měl, jako ich problém. Ale ono zase na druhou stranu. Když to byly bozmičky začli vynucovat podpisy 64. Tak byly problémy i se v té dějička mám. Že jsme se nastartovat v okno do speciálního režimu, když ti to dovolilo na instalovat nepodepsaný bovlak. Jo, a to bylo šílený, jako než se vyřešilo to dnes. A to byl to na mega poprosil, to bylo na 3 restarte, to bylo šílený. Já teď už to našte si, jak to nám funguje. Hele, to dlen stu chvíli se neplánuje, protože já si, jak jsem pochopil, oni už těch šílů docádos rozprodali, tenhle jsme ten trénink dělali v Praze pro nějakých 15 lidí přišlo v Praze. A dosť cich už ty šílili, jako nakoupilo do škole. Že tím, jak to bylo, ještě před koncem roku, tak prostě klasika. Do konce roku musíš utratit prachy ve firmě, nebo ve firmě, ve škole. Takže už to, takže už vím, že to má nějaké, jako školy po Praze a třeba z takové ty domy dítí a nláde, že už to má jako nakoupenit. A začínaj to, začíná se to nějak učit, no, konočit. A skle. Proste už je plné. Jsou? Máte kvělit v mojí kontaktu? Steppan do Dehynské dot. To bude věci, co to bude. Takže to bylo většiný. Takže to je... Proste jen mail. A když se váště v Pálantě, můžu většinit v Váršáv, když jen v 4 výzdy, takže můžu v Váršáv, když můžu většinit v Váršáv, Ivening, budoucí, pro věc na tom, které jsem. Všechno, že se to vloušou, že to vloušou, že to vloušou, že to vloušou. Spravný, nebo to? Já jsem sprach. Ale já dobrna jezdí na svou žepky. Jsí jen, no je to tak, že já takto pokud někameru, já to potřebuji, já si to spojul, já to většel, spodlící. To, že v tu chvíli mám opravný doma, jednostou je cestu, a tady po nocich školení. Takže, tak, většel, že můžu jen, jak se vedou iť, když většel, že jen, vlastně si to hodí, takže se mi očílepí, takže můžu nám aji děčinou Brezordy, takže nám aji tam chvapí, tak se dělá letovný tůl, ale vám kověčil, a dělá nebrezordy, takže taký jedný poškolá jí, mám z většenů, takto nám většel, Tak ale já můžu, jako je slychtěj, tak tady je na mě, tady je na mě, tady je na mě, kdyby mi napíšou, protože v ním to pro, v ním to ten CZ-tny, v ním to tam, v ním to tam, v ním to pro, v ním to brodá, tak to jsi, když mají hlavíčku vzdělávací urměnoce, dělájte, dělájte, dělájte, dělájte, dělájte, dělájte, dělájte, dělájte, dělájte, dělájte, dělájte, dělájte, dělájte. No tak to není problém, tak to není vůbec problém, to jim CZ-tny normálně prodá. Já se mi to myslím, já chtěl do nesměrom dávu. O bohužel, já mám taky počený to dnes. It's CZ-tny is the company taking care of top level dot CZ domain. And you know, they are the organization, it's a non-profit organization, so they are not established to create profit and they must giving the money back. So they are sponsoring a lot of projects like this and the only way, the only thing is, everything must be open source. And for us, we designed it as an open source in the beginning, so it was a lot of work and we designed it as an open source and open hardware for the beginning, so it was absolutely important for us. And they have, you know, they can do, they can found your project like this with a lot of money. Break the debt, take it, take it, have it. You know, give the money back. And they are very open, including the jetting manager of the CZ organization. It's very open to those projects. It's really getting great cooperation. OK, thank you. Thank you, enjoy the conference. Díte se, díky. Na torabzbery, na torabzbery existou taky šildy, ale jsou pekelně dragíte. Vonek sa tohle nepájeví o kontaktního polie, problém, když si koupíte nějaký z činy, tak voni činání uměj elektroniku, voni neumějí tu mechaniku. Je tam je úplně normální, že tam prostě máte někde nějakej vaklu, který osi, jo, který osi ani nevšimnete a to prostě bez nejakýho, bez osciloskópoje blzíča, na to nemáte šansy, ale to jednou si koupíte. To jednou přijde. To přijde. Máv drhý koničky. Přesně tak, no. Nepožiju Arduino. Požiju to SP. SP 8266 čip. Programuje se to stejně jako Arduino. Akorát už to má v sobě Wi-Fi. Takže použil todle a v onovi finále ty vývojový desky s tím SP-čkem jsou násobně levnější, než Arduino. Akorát mají mnohem méně vstupu a výstupu než Arduino. Takže to takový vybalancé na někde, ale já typicky prostě radši použiju, prostě použiju jiný čip, než aby se se... Programuje to tak. To, co jste teď kaviděl, vám na to bude jednokadný fungo. No. Skoro je hlak jedný. Tostě někedy kýhovny prostě fungovat nebudou. Takže Čech musí celšáhnout do plnů někde tam trošku něco poboupravit, aby to chodilo. Ale zatím zatím většina věcí vyfungoval. Hle asi se nebyčekli. Tady má tuto štášků. Štášků? Don't forget anything. I hope I have too many... I have a lot of mess here. So okay, I need to put this on here. There's a big bag. Here. Okay, so here it's different. It's a bit different. No je to mojí jistý, ale je to tady tady včasný věcí. Vy dvěi a hd. A to je to. A bylo to vždyč. A vůbec nás. Už se je to. Už se je to. Když jim to mohli to pokudovat. A máme to záležit. A vbude to když se jim to včasný věcí. Ať mi je to zlepšit. A když se jim to zlepšit. Ať mi je to zlepšit. No, to nejde nejde nejde nejde. Nejde nejde. No, je nit, prepresen. Tak je, jen tak, když jen tak. Oh, je. OK. Když jsou mnohy? Všichni jsou mnohy. O, to to je asi sajtou. Žežíš to? Přesně. Přesně. Přesně. Přesně. Přesně. Všechno, dollop... Přesně. ...hámi? ...Ej. Přesně. Přesně. Přesně. Přesně. Máte? Ne. Já nevím, předtím se. Máte? Můžeme mít závodným závodným závodným závodným.