 ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... že v ČIP Arduino máte velice čip, který se vytvoří se vysvědí vysvědní a seriální port. A když v sereální portu je vysvědní, když se vysvědní portu vysvědní a seriální portu vysvědní. A tyto, když se vysvědní portu nevysvědní, když se vysvědní portu vysvědní. Je to dvou vędorů schování něco takového čipu. A první je FTDI, to je velice, perfektní vysvědní, který se vysvědní na všech operatingch systémsach. Ale to je zvukovat vysvědní. A když se vysvědní portu vysvědní, když se vysvědní portu vysvědní. Je to a kompanie, který má něco, který je chcičí C4Z. Je to někdo největné výstře, které se je vysvědný v podíle. Výstře mluví vysvědný vysvědný na Mac a na výstře výstře. Když jste výstře výstře, když jste mluví na Internetu, když se vysvědný vysvědný výstře. Je to vysvědný na Linuxy. A za návětné chci, které se nezávětné Linuxy vysvědný na hrým disku. Nyní se, který se vysvědný na hrým disku. Nyní se, které se vysvědný na IDE, který se pošlí se na to, který se nezávětné na Archive. Nyní se pošlí se na to, který se nezávětné na Linuxy. Na Linuxy jste mluví na výstře, který se nezávětné na Linuxy. Na Linuxy jste mluví na 64-bit. Na Linuxy jste mluví na Windows Machines. Zvukovat idei a vzlážují arduino a vzlážují vzlážují vzláží. Vzláží jsou na flash disku 2. Jsou 4 žádnice, které si vzláží. A když linux je vzláží nebo vzláží. Přesně vzláží na vzláží. Vzláží nebo vzláží na vzláží na vzláží. protože v tom těch nejlepších dělávům než než se příšel a nává sečí k vzájící než si příšel, což je C-H340. Pro mět, by je čeště zvížet k seštěm měnohy je zvížet z FTDI protože to mohlo většit k nejlepších dělávům s ním dělávům. Proto zvukávysím si než až s FTDI Sávad na côté Muchas poněji, vždyš tam tu... Z buttons a na velkou sez ["winoosystems"] instađu dvařímu. Dvaří jsou v první, a dvaří jsou v pováz. A na dvaří sez ["winoosystems"] bude se... bude se Arddino na deva, dty i je nyní standard serial port... Do nyni ne? Tak bude se... bude se z vys P4 Apple. A neringe si tedaž odstav jazel Myslíte, že jste v děloutu grupu Linuxu, aby můžete připravovat děloutu děloutu děloutu s sudu Arduino IDE. Takže jste můžete s děloutu děloutu grupu Linuxu. Když jste v děloutu Arduino IDE, jste můžete vidět něco takého, Racing, climax,hipopi cockroて, dělout od CRCH, vzel. Kdež máš dělout, jste můžete vidět něco takého, jak lägu svý děloutu děloutu děloutu děloutu puló waiver.tense udělý ils Commissioner děloutu děloutu Polish Enterprise. Main shovel v zfukerionu děloutu děloutu děloutu substance. Začinalu děloutu Babecause, které jsou přijít z Arduinoví. Děkajte, jak se vám přijít, kde jste, jak jste vytvávají. Všichni jste, jak jste vytvávají, když jste kvůjevá, když jste vytvávají, kde jste vytvávají, kde jste vytvávají. Vnitě je to, jak vytvávají cí, protože všechno, které jste vytvává v cí, to nejlepší těžké, ale je to pojď cí. Proto se vzájí. To jsou nějaké zvuky. Dělout. Dělout. Dělout. To je zvuky na serioportu. Ok. Můžu mít tím, aby se zvuknit Arbino IDE i install driver, když můžete. Arbino je nejlepší device. Arbino je celý ekosystem. Arbino je device. Arbino je IDE, lehle zvukováli nejlepší devices. Trhlež to co tam zvuknilo je zvuky, když se zvuknit Arbino projekte. Mále jsou nějaké zvuky od můžete, takže jsou nějaké zvuky od můžete. když je nejlepší, protože systém je nejlepší. Arduino IDE můžu vytvořit nejlepší arduino. Dojíte ESP8266? Je to vyská mikrocontrolera v Wi-Fi. Je to vyská mikrocontrolera v Arduino 2. Je to vyská mikrocontrolera v TX instrumentu, který je klunčpet. Je to vyská mikrocontrolera, který je vyská mikrocontroler. A zděláte, že je to vyská mikrocontrolera. Je to Arduino IDE, který je vyská mikrocontrolera. Je to na nás v LUNCHPAT board. Tady jsou mnou, které Arduino je veliké ekosystem. Vyskáváte, že je to vyská mikrocontrolera. Vyskáváte, že je to vyská mikrocontrolera. Tady jsou vyská mikrocontrolera. A zděláte AKÉ mi control. Jak se se je o mnou půjde, byste píli dumanové, z fraternatí pak na mojoj vás použitosti offers. A vOTHERF ね. Tady jestli ver Kennmx nehovinné sk numeric ostatné d мира, vyskáváte ale sleeupa, kojiک de lépenékme, alguns vydražanyů, Vypivně se je dělává, když je mikro-kontrojář, když je 80 MHz. Tady je mikro-kontrojář, když je atmel. A to mikro-kontrojáře jsou 8-bit mikro-kontrojář, když je 32 kb flesch, když je dělává a 2 kb ram. 2 kb, nejmega, nejgiga. To je bude to spět na application z jakich nejde na světě. Je to vyrpředivá, když je vyrpředivá, jen je návězda, když je k當erovánem osumří. Když se budeme si děláváelně, ní na dvěle je určiderský mikro-kontrojář, když je jen na Arduino. Nyní Arduino, protože je to 80Mhz a 328p. Jsou největné věděle. Protože jsme měli Arduino v microcontra, měli mnohé GPIO, měli mnohé memóry, než 2 kB a 3 kB a 4 kB. Protože jsme mnohé věděle. Protože jsme Arduino v pohledně v arm microcontra s kortyx M0 core. Je to největné 32-bit microcontra. Protože jsme mnohé Arduino, měli mnohé memóry, než mnohé memóry, než mnohé GPIO, než mnohé memóry, než mnohé memóry, než mnohé memóry, než mnohé memóry, než mnohé memóry... OK, prostě měcháte. Když si je řeší je hodiní. To je s hodinou hrdom s hodinou hrdom s hodinou. A hodinou hrdom s hodinou s hodinou je než mnohé beings. LED je největné diali, tato je páčletí. LED je přijít na nás, a to je na dvečku. LED než než než hodně hodně hodně. A takže se je zrůžit, když se je zrůžit, když se je zrůžit. A nevědět, který je zrůžit, je zrůžit na Arduino. To je zrůžit na schvíle, takže než jsme vytvořili, že jsme zrůžit. A mikro-kontroller A je to nějaké kvíře. Vypadá nějaké kvíře a to kvíře je vychvětně vytvětně kvíře na kvíře na kvíře. A když se s nimi zavrátilo, nebo se to zavrátilo? Takže tu je kvíře, to je mikrokontrolér a kvíře v mikrokontroléry je vychvětně vytvětně kvíře na kvíře. A když se s nimi zavrátilo na kvíře na kvíře na kvíře na kvíře na kvíře na mikrokontrolér. Tady je hodně vytvětně nebo vytvětně. Prvědějte, když se s nimi zavrátilo na kvíře na kvíře na kvíře na kvíře na kvíře na kvíře na kvíře na kvíře na mikrokontrolér. Dejte, jste po výhodně, takže máte vždy kvíře na třeba než končtě. Tam se tu hodně zavrátilo na hodně, 3,3 V. Ve dvějte bývě je dvějtcké vodně, len 1 vytvětně. Nossa s nimi je dvějttere nám vytvětně, takže nám vytvětně na hodně, a to je teď než hodně vytvětně. Je to sleptká která pi, která lehá v organizingi. Je to sleptká. Je to sleptká. Je to sleptká. To je sleptká. A je to sleptká. A to je sleptká, která je nekontygulějské, které se závět se přijadí na morphoziku. Je to vytvořiločené všechny aplikace. Příklad na Arduino vědějí, že jste tady vytvořiločené 7V a 12V. Je to tady vytvořiločené 9V battery. Je to vytvořiločené. Je to vytvořiločené. Je to vytvořiločené. Je to vytvořiločené. Má hodně hodně největě to vytvořiločené. Káma tady vytvořiločené nyní jsí hodně hodně hodně. Takže nebo nebo když nemämi zvuk Wait机, ale kdo kdo zvuk než se závodí? A ano to nená delik, v pozdělává nejlepší vrd, kde není mají stále. Ano dvěto zvuk a zdělává pro svén tenhle. a to je nejvědět nevědět, nevědět, nevědět a ty je vždyčně vždyční. A v závodě je vždyční. V závodě je vždyční. Protože vždyční vždyční. Takže, na flashdisku, když mám všichnit, tady je náš folder, který je Arduino Workshop. Třeba je toho structure. Arduino Workshop folder je to, který mám mnohé třeba. Děkuju, jde se přednout měst. Přednout filo, sklep se do filo, tady je to měst. Nebo jme se tady nás než zlep nás. Už se to v ten filo přednout. A děkuju si od výrody výrody. Děkuju, jde se přednout, tady je měst. a se se vzájí něco takého. Přesně se to odpovědá? If you want, you can download... If you go to GitHub and you search my name, Bechinsky by eezyhy and sky, so you can find the Arduino workshop on my GitHub, just clone it. So, you understand what constant is, you know what is integer. So, LED, so I am working with spin2, we are using the numbers of the pins from the Arduino board, we are not using the name of the pins as on microcontroller. So we are using, we will use spin2, pulse is constant 1000, because we will use it in function delay, function delay stops the microcontroller. It stop it, but it doesn't send it to any sleep mode, so it still consumes a lot of energy. There are ways how to run it to the sleep mode, it's a little complicated, but it's possible. In setup, I say hey, I want to use this pin LED, so pin2, and it will be output, so you must specify if the pin is output or input. It's very, very important. So, without this, pin is not, let's say, connected, and it will not work. So, you need to say in the setup, hey, I want to work with this pin, and it will be output. Digital write means, OK, send power to pin, high, so it means 5 volts, in this case, it can be 3.3 volts, then wait, send low, and wait, and do it again, again, again. So, it start blinking. So, what you need to do now? In tools, you need to choose the right board. So, our board is Arbino-genuino uno. This is our board. It's a very common mistake, that you choose a wrong board, and then it doesn't work. Because when you choose the board, on the background, you choose the type of the microcontroller. So, compiler knows how to compile it, to run it on the specific microcontroller. Because there is no operating system on the microcontroller. You need to compile your application for special, you know, for the right microcontroller. If you compile it for different microcontroller, it will not work. Because there is no abstraction layer. It really runs on the hardware. Very, very low. I will show you how it works later today. So, you need to choose the right one, because this is different kinds of Arbino's, but it means they typically use different kinds of microcontrollers. So, you don't need to deal about the microcontroller, how it works on low level. You just choose the right board. And then you need to choose the right board. And then you just press the button this. Error. It starts compiling and uploading application to the board. And the blue light should blinking. Yes, it's a TTI something on the Linux. That one. This is the right one. Because you are not in dialog group. So, run. I don't know. It's a dialog group. And I'm not sure maybe you need to somehow restart or run it as to do. It's another option. What should I choose as a programmer? No programmer. There is no programmer. If you choose the right board, if you choose Arbino, Uno, you choose port and that's all. So, if you see many in many programmer, you probably choose a wrong board. It must be Arbino Uno. You know, because there are some, for example, if you buy Arbino... I think it's Arbino Mini. There are some Arbino Mini boards with 80 mega 168. Some of them is 328. So, you need to choose some type of the board sometimes. But Arbino Uno is just Arbino Uno. So, you should choose just Arbino Uno and port no programmer. And LED should start blinking. So, welcome to nice world of hardware development. Believe me, it's much more fun to write application for those things because you can destroy it very easy. You can destroy very easy yourself. So, special when you play when you will play with power plugs with 220 volts. Be very careful. It hurts. Believe me. And it's really nice. So, because it's a very simple system there is no simple way how to debug your application. It's possible to debug it, but you need different tools, you need different hardware. It's more expensive then. So, only way how to debug it is to send some information from Arbino using the serial port to your computer. So, open file and there is serial communication. So, please open serial communication example from Arbino workshop folder. Serial communication is very old fashion. Serial communication is very old way how to communicate between two devices. Serial communication is used a lot everywhere. So, do you have mobile phone? I think you have mobile phone. Do you know that inside the mobile phone is microcontroller? There is some processor. Do you know there is another electronics called GSM modem? This is the device connecting you to GSM network. And the communication between GSM modem and the microcontroller is a serial port. It's a serial communication. If you have GPS same, Bluetooth same. Serial communication is a very important one and you use it a lot. But serial communication is sometimes tricky. So, first is that the part sending data and device reading the data must run on the same bitrate. Because it started sending the data and the opposite side must read the data in same speed. If not, there is a problem. So, both parts must agree on the speed of communication. It's the first problem. Second problem is if you have a standard Arduino there is only one hardware serial port on the microcontroller. What does it mean hardware serial port? There is a special electronics inside the microcontroller doing serial communication for you and it doesn't block let's say the main core inside the microcontroller. On standard Arduino there is only one hardware serial port and this mod is used to program your device. The option is to use the library called software serial. The library software serial emulates serial port but it really doesn't work smooth. There are some problems because of the timing and everything. It's a last choice. So, what to do if you need to use the more serial ports? What to do? Just choose another Arduino. Arduino Uno, only one. If you take Arduino Mega Arduino Mega is used to control 3 printers. Or hardware serial ports. Or you can use something called Arduino Leonardo. Arduino Leonardo use different microcontroller and on this microcontroller is direct support for USB. So, this is used for communication with computer and you have one hardware serial port free there. So, just use another serial port. Sorry, another Arduino. So, it's very simple again There is a library there is an object called Serial Object Serial is port using to communicate between computer and Arduino always. If you have Arduino with more serial ports there will be object Serial 1 Serial 2 Theoretically Serial 5 It's used on a very special port. But Serial is always communication between computer and the Arduino. Serial 1, 2, 3, 4, 5 I used to communicate with different hardware you have connected to Arduino. So, you choose the Boutrade. Typically, the numbers are 1200 2400 and you just multiply it twice. 9600 is the basic speed. You can go up to 15000 something. Theoretically more, but that won't work. This loop here is sometimes needed and sometimes not it depends of the type of Arduino. So, some Arduino sneak because the microcontroller it waits until there is something connected to serial port to really set it up. I have it here just because of this problem. But for Arduino you don't need this piece of the code. It's just for some Arduino. Again, you need to check documentation. Serial.print Surprise, it sends data to computer. Then, you convey if there is something waiting in a buffer. So, if the available means the number of bytes in the buffer. If there is one byte, it means something going to Arduino and then you can use different methods start and create to get data from the buffer. The read strength means everything in buffer is interpreted as characters or you can use just read. It means read the byte and then you interpret the byte by yourself. So, if I upload this one to my Arduino there is a very nice in tools you will find something called serial monitor and serial monitor is a very simple window where you can send data to Arduino or read data from the Arduino. Of course, you need to choose serial speed and then can I send data to Arduino. If you choose different speed you will see stupid things like this. This means something is wrong with your speed and if you change the speed it automatically starts the Arduino. So, try it. Because the communication between those two devices using the serial board use some buffers. So, it really doesn't mean that everything what is send it from one side end it in the buffer on the opposite side like a one piece of the information. So, sometimes you need to read the data until there is some special character or something like that. I show you the example. Do you know GPS protocol? So, this is how this is the piece of the communication from GPS. So, GPS sends you those kind of information. GPS is typically connected on serial port. So, you need to know the protocol because in buffer sometimes you will have line two characters or you can have a half line. It depends on the speeds on the buffer size. So, you must know, okay, the line start is dollar sign and end up with something like star and number. This is a control niso check. Check sum, thank you. This is the check sum of the line. So, you must know how to interpret the data. Because the communication really something going in, out and it's never mixed up. But sometimes you get in buffer just this, some this sometimes there is nothing you need to wait to fill the buffer and so on. So, the communication is sometimes tricky to process it but it's extremely simple. The communication between those two devices. Okay, do you have questions for serial communication? Yes. Okay. Yes. It reads it interprets bytes in buffer on Arduino. So, if you send something from computer to Arduino this is the way how to read it. Okay. Yes, it's possible. There is a way if you need, there is a for serial port you can create an event which fire up when some data are available in buffer. It's possible to do it. If you are really working on the microcontroller knows how to work with interrupts but typically the Arduino the concept of the Arduino taking you away of those details so you can use only two kinds of the interrupt when you are using just Arduino IDE. One is for serial port and second one is you can set up interrupt for some pins and for interrupt you can use just two pins because the microcontroller on this kind of the Arduino supports just external interrupts on two pins. That's all. But if you do not use the Arduino IDE or you can use it but you will go let's say one level closer to hardware and you use timers as interrupts and much more. This one is an extremely simplified way how to program the microcontroller and you cannot control everything on it because there are so many things and every microcontroller works a little different way. OK, I show you almost the same I show you the blinking the diode without without Arduino IDE This is very how to blink the diode without Arduino IDE This is the loop this is the setup and I am using interrupt to change the diode's LED state This piece of the code will work if I copy it without the main method if I put this one to setup the while I put to the loop it will work but it will work only on 18 mega 328p because this is the name of this is the names of memory registers and if I use different microcontroller the name of the registers will be different so with Arduino IDE you don't need to take care about those things because there is some abstraction layer but this abstraction layer takes you away from the hardware so for example you cannot use in Arduino IDE there are no functions to use timers like interrupts but the microcontroller can do it but then you need to know exactly how to do it on a particular microcontroller and typically you cannot use it the same way you cannot use it on different microcontrollers because it's not compatible with the memory registers ok so let's start work with the buttons we will do something more complicated we will use LED on grid 5 and then there are 3 buttons we will use just 2 of them so there is one button connected to pin 9 and one button connected to pin 10 so if you press the button if you press the button what happened? you press the button so pin 10 if I press this one on pin 10 I will have 0 volts because if I press it I close the circuit and I will have 0 volts how many volts what is the logic state if the button is not pressed so this is disconnected here I am not pressing it, it is disconnected so what is the state of this pin call it a t ne it's not defined no one knows because it's floating somewhere so those buttons are connected wrong because you have unknown state here so if you press it the state is defined it's connected to ground 0 if it's not pressed it's floating you don't know what is here and you cannot tell it because it's unknown really, there is no electric potential unknown so it can give you random number 0, sometimes 1 it's floating so you need to use something called pull up resistor what does it mean I have ground here here is my button and here is the pin where I want to read the state of the button so if I press the button here is 0 ohms so electric goes here is go to ground if is it not pressed so here is infinite resistance thank you so the resistance is infinite here so I have some resistor here 1.8 kilo to 10 kilo ohms so because here is it infinite and this one is much smaller than infinite so electricity goes here and here I have 5 volts or the high potential because if I press it here is 0 here is some kilo ohms so 0 is much much smaller than kilo ohms so electricity goes here it's called pull up resistor this is probably the most complicated electronics we will do today you must know about that because never ever if you want to read some information from the pin the state must be known low or high and if is it this is not connected you cannot tell what is the state so happily on microcontroller you can find something called internal pull up so you can choose this pin will be input and please switch internal pull up on or if you use your pull up you just say hey it's just input and I don't need internal pull up so this one let's say it's wrong without pull ups but you can use pull ups inside the microcontroller second thing I want to press those buttons so the LED will start more and more and then going you know fade down and so on but you know that on the pin you can just set 0 or 1 so how to put there let's say half of the energy yes up and down up and down it's called pvm pull with modulation so it means that you have some duty cycle and inside the duty cycle you change the time how long is spin up and how long is spin down and the duty cycle is in kilohertz so it's very fast so you can see that it's working smoothly up and down but this is the way how to control the energy this is one way of course you can use something called digital to another converter there is no digital to another converter on Arglinos because it's a quite expensive and very sophisticated piece of electronics but you see you need to switch to pin very quickly so again it's not done by main cpu there is a special electronics doing it for you so if I go back if you want to use pvm you must collect device for pvm only to some pins so pvm is supported on pin 3 5 6 9, 10, 11 and if you try to use the same for example with spin 2 you will try it it will not work because there is no electronics doing the pvm pvm is a very important thing we will use it just for playing with the LED but it's a very important thing if you need to control servos or some engines because using this you control how much energy you are providing to the engine again never ever connect servo never ever connect some electric engine directly to Arduino because you destroy it very easy ok so please open file called fate keys so first one if you are not c developers we are using here instead of using the constants I am using here defined macros so this is very how it looks like so if you are if you know that you will use it it's very good idea to find some book about the c language and treat at least first 3 chapters you know it's still programming variables and so on but the specific things about the CR typically in first 3 to 5 chapters what it does define, include and stuff like that here you can see I am defining things I want to use and here you can see something new input pull up so I say hey on pin 10 I need to use the pin 10 as input and please I need an internal pull up too if you choose just input you need to use your own pull up you can try it it will not work because there is an unknown state and if we go here I check the press means connected to ground so low so if the button state is low it's pressed I have just some serial print here to debug it or to what's going on I wait some time and I check it again why button is a mechanic device if you press the button because inside the button is průžinka spring and you know it oscillates so you need some time to stabilize the connection so this is the way how you it's called that you are debouncing it so you are now I know ok it's really pressed it's not some accident because of some bouncing spring this number here is extremely high it's here because you can see it it's extremely high typically you need to wait like 1 millisecond or if you have so every piece of electronics should have something called data sheet which tells you how it works, how to connect it and if you find the data sheet for the button the one information you get how long it takes to stabilize the state of the button how many milliseconds so here you need to put something higher that you know ok it's really pressed then we do it the same way for key down I am just changing some value and analog write means hey set change the pvm on some pin the number from 0 to 225 so you can you know put energy outside in 256 steps and higher number means more energy so you have a duty cycle and then you can control how much how long it will take to put the pin on the high state so try this one try to change led for example to number 2 and you will see it will not work because on pin 2 there is no support for pvm maybe try a different button there are buttons up and down there are some arrows next to the buttons so it should work with those two buttons yeah but it's not smooth it switches on or off because there is no pvm on it so do you have any questions around that? some questions yes and what is the compiler there is the compiler behind AVRGCC the open source compiler it works for most for most of these ok ok it works that you have for every board you have set of libraries so IVE choose the right libraries for the board AVRGCC compiles together and IVE uploads it to Arduino board on the chip there is a very small bootloader and if you switch the Arduino on the first application the bootloader starts and waiting for one second if there are some data like if there is some programmer on the opposite side if no it starts up your application so you can what you can do you can take any chip used on Arduino also like 80M328 you can burn a bootloader to the chip and you can use it with Arduino IVE but to burn the bootloader you need a special device no it compiles it compiles, uploads typical problem is that you compile it for the wrong board you know this Arduino started the project of the Arduino 10 years old from 2005 and it started as a project for the students in Italy because they have to buy a very expensive board to learn micro electronics and those board were too expensive for them so they started to make it cheaper because if you want to program microcontroller you need to have some programmer, it's a device but in past those programmers were very very expensive now you can buy programmer for those kinds of the chip the programmer the price is 80$ from eBay but in past the price was in hundreds of dollars them expensive but now if you want to buy a good programmer with a lot of supporting different ways debugging and so on the price will be very very high too just the basic programmer the price is very cheap very low but if you want some nice programmer the price can be again in hundreds of US dollars ok does it work perfect so the button is the most simplest where do you use it for example again if you will check the 3D printers if the printer starts printing you need to find the printer needs to find 0, 0, 0 position and it's very simple on every axe you have a small button and it's going in one in x until the button is pressed it means here is zero the same for y same for z easiest way how to find some position this button but of course we want to use some more sophisticated sensors and we will use first our sensor will be the light sensitive resistor this light sensor is photoresister it changes the resistance depends on the amount of the light so let's say we have two kinds of sensors one sensors are digital so they are sending you data in some digital form so typically you have some kind of the bus there are many buses supported on Arduino boards you can use serial communication you can use bus I2C or I2C or you can use SPI common question, ok, i want to use canbus because i want to use in my car yes, it's possible, you just need to use an Arduino with microcontroller supporting the canbus there is no canbus support in Arduino IDE typically you use some special shield for it as art more things like that so this is the digital sensors or this sensor is analog an analog sensor means that it gives you the information as the amount of the voltage why is it connected like this if I because you need to know the state again so here the pins here on the right bottom are analog inputs so you can use it as a digital pin why not but they have special functionality you can switch on to use it as analog input so you can measure the voltage here this piece of electronics changed the resistance so if you connect it directly you can say what's there and there will be nothing so you need to use this circuit it's called voltage divider this resistor change the resistance this resistor is fixed and depends on value here you measure between the voltage because the current can flow here it is the ground with 5 volts so current can flow here and you can measure what's here because it depends on this piece of electronics and this piece of electronics the resistance depends on the light so this is the common way how to connect these types of the sensors ok, how to measure the voltage inside microcontroller you have a special circuit called analog to digital converter ADC it transforms the amount of the voltage to some digital number so here I have 0 volts here I have a 1 volt here I have 0 and here I have 7 8 7 so it's a 3 bit analog to digital converter so if I have this voltage the ADC returns 1 if I have something from here to here sorry, from here to here it returns me 2 here it returns 3 and so on so it's some kind of approximation on how do you know you have 10 bit ADC so it means the 0 volt is 0 and opposite is 1023 ok so I know the 0 is 0 what is the voltage for 1023 what is the voltage no no it's reference voltage what is the reference voltage it can depends on you because you have a special pin where you can put your reference if you don't use this one the reference voltage is the power voltage and that's a program it can be 2000 volts if the Arduino can survive 2000 volts but there is a problem if you don't have a very good source of the power this can be 5 volts or it can be 4.8 volts you don't know so if you really need very precise measurement of the analog you need to use a reference voltage so typically use a special electronics to create a reference voltage there are special devices just creating the very very precise reference voltage so measuring the analog input is little tricky if you need a higher precision of just 10 bits you can buy an external device typically connected to I2C bus which can have like 12 bit and so but the price will be probably higher than the price of the whole Arduino so what we will do more light means more LEDs up so we will measure the light here some number and we transfer it to number how many LEDs we want to switch on so the number is light scale so please open the light scale example and you can see that I am using I have a sensor here the sensor is A1 it doesn't look like a number there is a macro that A1 means analog input 1 so there is a macro for it again I need to say initialize the pins I will work all for LEDs so I need to initialize it using the analog read you get the voltage so it's a number from 0 to 1023 and using the map function I here is a one scale here is another scale and it recalculates it from one scale this number is inside these boundaries and it recalculates inside those boundaries so I will have no LEDs all LEDs and again I do some stuff here what's the the new functionality of our Arduino IDE is that if you see I am just sending some number here it's a just number so what I can do of course I can use the serial monitor we use it before or there is a new tool called serial plotter and if you send if you send just number to serial plotter it creates a nice chart so I there is no light almost lot of light I have some butter in my pocket it's a lot of light here the light sensor is this one this is the light sensor lot of light if you change the sensor from A1 to A0 on A0 there is a thermistor thermistor is resistor which depends on temperature so you can use it to measure temperature just play with that and only listen a little what's very nice here so I have some sensor using the number from the sensor I am sending the number from the sensor using the serial port to computer so if you connect to serial port on Arduino not computer but you call there is something called bluetooth modem you can buy a small bluetooth device with serial port on it then you can write application for a mobile phone so any data from your Arduino using the bluetooth you can send to your mobile phone very easy because the basic bluetooth works as a wireless serial port it's supported on all platforms it doesn't matter if you are using the iphone or some android or windows phone it works everywhere so you can very easy use Arduino as a source of the data for your mobile phone it was used during the Fukushima nuclear power plant disaster because the tsunami destroyed a lot of things around the nuclear power plant and no one knew what happened there in terms of the radioactivity so there are a lot of volunteers they build it a device measuring the radiation device has been connected to mobile phone and they just put it there and until the battery was working they get the data real time so very easy way how to use those kind of devices together with the mobile phone and you can connect it via bluetooth because bluetooth is a serial port in this term ok some questions about analog sensors ok we have 20 minutes more so now something very important ok so here is a display and the display if you look on the display you see some letters here some numbers and every segment of the number is LED so you can see there are a lot of LEDs and those LEDs create the characters but you can imagine that there are too many LEDs to control every single LED supportly don't do this please do not disassemble it so if I put the display away you can see that there are some pins and there are not so many pins as you have segments here but for this place you have something called driver so this piece of the electronics controls the display and communicates with the microcontroller happily there are a lot of different displays in different shapes but there are not so many drivers to control them so you can it doesn't matter what the display you are using for you is more important the type of the driver the driver the name of the driver is TMC 1603 i think and this driver for the display is very special because the data sheet for this driver is just a picture of the driver and one sentence in Chinese so documentation zero but we are in Arduino world so for everything you can find ready to use driver so how it works so imagine you have some something you need to control it from Arduino so easiest way how to find something is this one so let's go to ebay for example Arduino let's say RTC RTC is real time clock we will use to work is this so i have this nice real time clock and this is the name DS3231 this is the number of the electronics so every time you buy something like that you just need to read from the chip what is it so you copy first solution if you go to tools sorry sketch include library and here you have managed libraries and just you just search for the name of the chip here we are i have library to control that kind of the chip very simple so you don't need to know that who did this module it's not important the important is what is on the module so you need to find the number on the chip and they are looking for the name of the chip it's very very unusual if you don't find the library for it for almost everything you can find the library if not this way you just google it yes it tells you there is the library manager is quite good here so it tells you there is a new version of the library the same way you can manage boards so for example if there is a new board you don't need to download again everything because there is a board manager and you just download the support for the new board it's very very useful this part because it's open source almost all those libraries are somewhere as a source code because you cannot get those libraries precompiled because you need to compile it every time for the specific microcontroller so all those libraries are somewhere in form of source code so you can look at it how it works and this is the best documentation you can get the source code for the library unfortunately this tm 6 1 3 6 you can see I have it installed already but to find this library was extremely difficult because it's a part of another more libraries so it's almost not searchable itself but never mind you can find this library in folder you downloaded from the flash disk so if you go to Arduino workshop folder here is libraries and inside libraries you have a couple of subfolders those subfolders contain the libraries for our shield tm 16 36 is the library for the display and there are some libraries for real time clocks but we will use it later where to put those libraries first you can copy content directly to the same folder with your application it's not good idea or what you can do if you go to your home directory you can find a new folder there called Arduino this folder is automatically created for you when you first time run Arduino IDE then is subfolder libraries and you just copy the libraries there and you need to restart the Arduino IDE that's all so please copy at least tm 16 36 library to proper place so in home directory there is Arduino with capital A there is a library so put the tm 360 1636 copy whole folder it means every folder is a one library nice library for encryption so Arduino is enough powerful to use us so think about that because if you are so my main expertise now will be IoT Internet of Things and believe me almost no one is taking care of the IoT because people are stupid so even simple chip Arduino can use quite powerful encryption and encryption mechanisms you can see I have SSH libraries too so you can use hash to again to protect some your data sign your data and it works even on so weak hardware as 8-bit microcontroller ok so now if you open from Arduino workshop now you can open measure temperature application at it will measure the temperature and you will see the temperature on the display so only one thing here I would like to tell you here you can see so when you measure temperature you read the information from the analog input so it's a number from 0 to 1023 and you need to recalculate it to temperature so where to get this formula for recalculation in data sheet for thermistor so you need to find the data sheet and then get it imagine situation you have a green house and you want to control temperature in green house so if the temperature is too high you want to open window on the green house if the temperature going low you close the window in green house and you know that the limit for the temperature is let's say 40 degrees of Celsius so do you need to calculate if it is 40 degrees of Celsius or not do you know to do recalculation for this you don't need because you can calculate hey 40 degrees means that I get the wrong number will be 267 because this one this calculation is very very expensive to calculate it need a lot of cycles of the microcontroller special calculate the logarithm is extremely difficult and everything is done by software because 8 bit arduino doesn't support floating point there is no mathematical processor of course you can find microcontroller is mathematical processor there is no one so this one takes a really a lot of CPU time if you run something on battery you need to save energy as much as possible so this one can have a significant impact on power consumption so you must think you have 8 bits 2 kilobytes of the RAM and it consumes energy you want to run sometimes on battery so really think if you need it or not ok, so just try it and the last thing I show because we have last 10 minutes so in last 10 minutes I explain you how it works on low level because I think it's really interesting you know the play it will just show you temperature but what is important now is for you how to search for libraries how to install the libraries so this is the main topic of this example ok probably you will see absolutely different temperatures around you it's a cheap Chinese shield and believe me the electronics on it is very cheap so the precision is close to zero so ok the last thing for today this is the pinout of the microcontroller using the package is different but this is the pinout and you can see that the pins are named like P, D, B and C and some number P means port and D is the name of the port inside microcontroller there are lot of memory registers and the memory register controls what's what's going on inside the microcontroller and if you are not using the Arduino you are working with the memory registers and those memory registers are different almost on every microcontroller so it's quite complicated but if you know this you can do a lot of funny stuff very simple sorry very simple example or training I have four LEDs I want to switch them on and off exactly the same time so if you use the digital write it's one digital write second one it's not exactly the same time sometimes it can be really important but if you know how registers work you can do it in one time because typically if you have the port D everything is the same name D can be control that you change the content of the proper register so if you open example called if you open example called blink all port D is the name of the register controlling all D pins so it's an 8-bit register so every single bit inside controls one pin DDR means data direction register I am working with port D so DDRD I felt ok these pins will be inputs or outputs some binary logic here so I have this one controls PD0 PD1 PD1 PD3 PD4 because they are connected by LEDs and using if I change the content of port D it's a memory register I really change the voltage on the single pins because every bit inside the port is one pin, one physical pin on microcontroller this is how works microcontrollers on low level what you only think you are doing is that you are setting up proper registers and then you are controlling the microcontroller if you are using the Arduino you don't need to deal with this because Arduino libraries is doing that for you and probably last thing for today yes no no you just need to initialize the pins using the DDR register and then if you change the content of port register you physically change the power on the pins and laughing for today I show you how it looks like if you are blinking the LED and you use the low power functionality of the microcontroller so this line I am setting here register core p r r power reduce register and every single bit in this register can switch on or off sub system on microcontroller so for example this one switching off TWI it's SPI, bus and I2C bus some timers this one you can understand it this one switch off serial communication this one switch off another digital converter so you can switch off some subsystems register and you switching sitting up bits inside the register you are something switching on or off so this is the main logic how the microcontroller works just changing memory registers if you want to use serial communication on the begend you need to switch some registers setup and there are some registers working like a buffer containing what you want to send or what you are getting so you know you don't need to deal with this so it's nice ok you have 2 minutes any questions it's not there if you are interested in this there is a very nice series on YouTube by Atmel explaining how it works just look for Atmel on Atmel channel on YouTube this is a really really great series or if you are really interesting in it what's very nice if you probably know Kursera for training online trainings there is a one called very similar web called edx edx and there is one training about microcontrollers really great one and it's about cortex and stream microcontrollers but all microcontrollers work the same way ok some more questions we use this shield you know this shield is a kit for clocks but we are using it for our trainings because we are running those trainings quite a lot we had in last year we started on September and until December we had almost 250 attendees so we bought it from our money and because we think it's nice to teach people using those kinds of electronics so it's a shield you can buy it on eBay the same shield the price is around 200 crowns so it's not so expensive but now we are working on the new shield which will be better for education I hope the shield will be ready in 2-3 months but this one is just for playing ok some more questions ok if not please send all Arduino's on that site I take it home back it depends how much money you want to spend how much it depends how much money you want to spend because there are some various technologies like ZigBee, Char, Industrial one but they are expensive the price of one module is like 25 US dollars it's very very expensive or or you can use some very cheap modules for frequency 433 but you will have a lot of how to call it a lot of interferences security zero by the price of this set receiver and receiver is like 2 US dollars or no shit you need to look about the money or one more can be interesting it depends from which country you come from Austria because there is something called Sigfox Network Sigfox it's a french company and they are building network similar to GSM by just calling small amount of data and the money for the Sigfox Network the price is around 5 US dollars and you pay some fee every year but for one more then you pay something by 10 dollars a year and it's a global network very similar to GSM by they can buy GSM shield or by GSM shield but it's energy consuming I'm working like it's like so it has buy you should make this To je hrozný distro, co? Musíš jak možný chvíl. Cože? Čeče, zatím jsem jen stratilo žádný. No. To je věc, vít, že to se čeká. Jako možná, jsem tady přišel u nějaký fleš desky. Že nevám počet, že jsem nevrátili všichni, a ty se nebrouvali. To je nějaké ošpivé distro. To je hrozný distro, co? Musíš jak možný chvíl. To je hrozný chvíl. To je hrozný chvíl. To je hrozný chvíl. To je hrozný chvíl. To je hrozný chvíl. Žloká. No, já si, že? No, vílejte. To byla větší, že to bylo větší. No, a já si, že to bylo větší. No, počet. a není, není děkuji, nejniší jakoby soubě možnosti. Existujou speciální čipy, které to to dělají. I můžete normálně takhle můžete čipují, ale to jsou drahí, blbě se schánějí.