1 00:00:00,700 --> 00:00:02,320 Hello and welcome this new Arason. 2 00:00:02,650 --> 00:00:05,980 Now let's start by quoting the first method. 3 00:00:06,460 --> 00:00:09,100 First, we need to read the incoming data. 4 00:00:10,210 --> 00:00:21,460 So light humidity, low humidity equals DHT, which is the object that we already find, seed humidity. 5 00:00:23,780 --> 00:00:28,250 And the next one is for float for that temperature. 6 00:00:30,520 --> 00:00:33,010 By DHT dot read. 7 00:00:34,870 --> 00:00:46,120 Then, Richard, now we have the humidity and temperature to send them, we can easily use the Vishwa 8 00:00:46,120 --> 00:00:47,800 light function. 9 00:00:48,280 --> 00:00:55,180 The original Blinkx Library has a method called Vishwa Right, which is used to drive the sensor reading 10 00:00:55,450 --> 00:00:56,920 into virtual bins. 11 00:00:56,920 --> 00:01:02,770 We have or we will define and configure and our link up. 12 00:01:02,770 --> 00:01:09,760 So to do this, simply write blank dot virtual. 13 00:01:11,800 --> 00:01:12,340 Right. 14 00:01:13,780 --> 00:01:21,580 Now, first, define the virtual pen, let's call it V.. 15 00:01:24,940 --> 00:01:27,850 Five, and we will send humidity. 16 00:01:32,590 --> 00:01:35,710 And we will do the same for the temperature. 17 00:01:40,950 --> 00:01:43,290 Let's call it the V for. 18 00:01:44,230 --> 00:01:50,390 And let's and the temperature in which. 19 00:01:52,130 --> 00:01:52,830 That's it. 20 00:01:53,040 --> 00:02:00,110 Now, this is the first function, now the second function, what we will do in the second function 21 00:02:00,110 --> 00:02:01,990 is basically the same thing. 22 00:02:02,540 --> 00:02:04,100 We will be the water level. 23 00:02:05,210 --> 00:02:08,900 And we already define two variables here and here. 24 00:02:11,080 --> 00:02:17,380 So the water level will equal unallowed read function. 25 00:02:19,600 --> 00:02:23,860 And this will equal analogue. 26 00:02:24,880 --> 00:02:36,270 Right now, we need to bring the two variables here, water level, sensor pin number and the salt and 27 00:02:36,270 --> 00:02:37,260 salt and no. 28 00:02:40,890 --> 00:02:47,760 Now we have two analog readings, and to map them, we can easily use this function you cut at water 29 00:02:47,760 --> 00:02:48,210 level. 30 00:02:50,450 --> 00:03:04,070 Equal mob and inside the mob, you can add water level and the range zero 2000 zero. 31 00:03:05,260 --> 00:03:10,450 Twenty five now, the same thing can be done for the. 32 00:03:11,540 --> 00:03:24,560 Moisture level will equal mud and we will do the very same thing, we will write more Circleville and 33 00:03:24,560 --> 00:03:33,400 we will add zero 4000 zero twenty five or let's make it 20 hundredths. 34 00:03:33,410 --> 00:03:34,040 Make this one. 35 00:03:34,580 --> 00:03:41,020 Now, this these values are depending on my sensor readings and the range that I want to get. 36 00:03:41,390 --> 00:03:47,120 Now, depending on your type of sensor data sheet, you need to make sure that you are choosing the 37 00:03:47,120 --> 00:03:49,460 right values. 38 00:03:49,910 --> 00:03:50,870 Now to know. 39 00:03:52,590 --> 00:03:54,960 The Arduino malfunction. 40 00:03:56,870 --> 00:04:06,050 Let's take a quick look at its description now, the map is basically a way to create maps, a number 41 00:04:06,050 --> 00:04:15,620 from one range to another that is available from law would get map to law now. 42 00:04:17,880 --> 00:04:24,000 It does not constrain values to within the range because out of range values are sometimes intended 43 00:04:24,000 --> 00:04:31,050 and useful, that constrains function may be used either before or after this function if limits to 44 00:04:31,050 --> 00:04:35,130 that energies are desired, depending on your end goal. 45 00:04:35,160 --> 00:04:38,720 You can either use the constraints function or don't use it. 46 00:04:39,300 --> 00:04:47,430 Now, I can see here the map will take a value and from law from high to low and too high. 47 00:04:47,430 --> 00:04:52,170 So it will turn the value from law to law. 48 00:04:52,470 --> 00:04:59,610 As you can see this to this and from high to high, as you can see from this to this. 49 00:05:00,810 --> 00:05:07,620 Now the value is the bottom up from low, the lower bound of the values current range from high, the 50 00:05:07,620 --> 00:05:15,330 upper bound of the values current range to low, the lower bound of the values target range, the one 51 00:05:15,330 --> 00:05:19,710 that we want to high, the upper bound of the values target range. 52 00:05:20,220 --> 00:05:22,770 Now, as you can see, this is an example code. 53 00:05:23,220 --> 00:05:29,450 We are mapping an analog value to eight bits, zero to 255. 54 00:05:30,750 --> 00:05:37,710 As you can see here, we are reading the value and here we are getting the readings from zero to one 55 00:05:37,710 --> 00:05:38,760 thousand twenty three. 56 00:05:39,150 --> 00:05:43,780 And we want them to be map to zero to 255. 57 00:05:44,340 --> 00:05:54,060 So one thousand twenty three will provide an output of two hundred fifty five and it will be stored 58 00:05:54,060 --> 00:05:55,030 the value here. 59 00:05:55,560 --> 00:06:02,040 So it's basically a way to change from this range to this range, as you can see. 60 00:06:02,970 --> 00:06:05,370 And we are using the very same methodology here. 61 00:06:06,450 --> 00:06:13,050 We are moving the values from this range from zero to two thousand to this range from zero to twenty. 62 00:06:13,680 --> 00:06:16,760 And here we are moving the values from zero to 4000. 63 00:06:17,100 --> 00:06:19,350 So this range from zero to twenty. 64 00:06:19,530 --> 00:06:30,150 And it's a very easy, straightforward and easy to implement way to change the range from a very large 65 00:06:30,150 --> 00:06:31,910 range to a very small one. 66 00:06:32,370 --> 00:06:36,540 And they will both provide the very same final result. 67 00:06:37,660 --> 00:06:45,310 Now, this is regarding the mapping, and since we now have the water level and moisture level, we 68 00:06:45,310 --> 00:06:50,110 can easily send the values using the uplink, the virtual. 69 00:06:51,250 --> 00:06:55,330 Right function here we have seven. 70 00:06:57,850 --> 00:06:59,310 Walter Lippmann. 71 00:07:00,890 --> 00:07:02,210 And here we have. 72 00:07:08,520 --> 00:07:10,230 Let's say v six. 73 00:07:12,410 --> 00:07:14,020 To send the most. 74 00:07:20,020 --> 00:07:20,490 Hello. 75 00:07:22,670 --> 00:07:27,560 Now, let's verify the code to make sure that we don't have any spelling or. 76 00:07:29,130 --> 00:07:32,520 Missing a.m. column for moving forward. 77 00:07:36,110 --> 00:07:39,260 OK, now, as you can see here, we have another. 78 00:07:40,550 --> 00:07:43,130 We have seen here. 79 00:07:53,150 --> 00:08:00,710 OK, here we have another cynical because I'm quoting and see Python and Java. 80 00:08:02,250 --> 00:08:03,300 Sometimes. 81 00:08:04,400 --> 00:08:10,090 Such mistakes happens because, as you know, Python doesn't have a semicolon at the end of each sentence. 82 00:08:10,980 --> 00:08:11,360 OK. 83 00:08:14,320 --> 00:08:23,570 Now, done combining everything is right now, we can add an extra step here in this area and this extra 84 00:08:24,250 --> 00:08:29,260 step will make sure that we are getting readings from the DH sensor. 85 00:08:29,800 --> 00:08:35,200 But if you have connected correctly, you won't need this step. 86 00:08:35,560 --> 00:08:37,660 You can add an if statement. 87 00:08:38,050 --> 00:08:43,480 If you are getting readings from the humidity and temperature, then move on. 88 00:08:43,630 --> 00:08:50,610 If not, then plant a cereal line, fail to read data from the sensor and you can do the same here. 89 00:08:51,370 --> 00:08:53,770 But I don't think that we need them now. 90 00:08:53,770 --> 00:08:57,310 We need to make sure that we memorize these numbers. 91 00:08:57,320 --> 00:09:04,740 We will give back to them in the blink explanation lesson. 92 00:09:05,830 --> 00:09:08,230 Now, we are done with this. 93 00:09:10,740 --> 00:09:12,760 Function and we are done with this function. 94 00:09:13,500 --> 00:09:23,070 The next step is it's configuring the set up and the loop functions and this will be an easy thing to 95 00:09:23,070 --> 00:09:23,370 do. 96 00:09:24,120 --> 00:09:26,690 Then we'll take another look. 97 00:09:26,910 --> 00:09:33,280 This called Bartletts Memrise, or let's make a quick overview of what we have done here. 98 00:09:33,510 --> 00:09:41,520 We have used the ESTIE object to create the humidity and temperature sensor values, and we have sent 99 00:09:41,520 --> 00:09:47,900 them to the blink up using V5 and V4, which are the virtual pens. 100 00:09:48,940 --> 00:09:57,120 So now we have used analog to need to read the water liberal and most liberal sensors value. 101 00:09:57,120 --> 00:10:05,130 And we have used the map function to map the range from zero to 2000 to a lower range, which is zero 102 00:10:05,130 --> 00:10:05,620 to 20. 103 00:10:06,060 --> 00:10:13,830 And in the most liberal sensor, we have used the map function to map these values from zero to 4000 104 00:10:13,830 --> 00:10:14,730 to zero to 20. 105 00:10:15,150 --> 00:10:24,510 And then we have some values using the virtual right function in the public library and we use V six 106 00:10:24,510 --> 00:10:28,770 and seven as virtual pens for the blink up. 107 00:10:29,430 --> 00:10:37,260 And the next lesson we will set up, we will write the code inside the setup and the functions to finish 108 00:10:37,410 --> 00:10:38,970 this coding process. 109 00:10:39,390 --> 00:10:40,270 Thanks for watching. 110 00:10:40,290 --> 00:10:43,950 If you have any questions, please ask in the Q&A about.