1
00:00:00,330 --> 00:00:07,110
Now, to make sure that you understand the shooting death of that we just created, what we did is basically

2
00:00:07,530 --> 00:00:16,590
the following we created variables and we have sent values or the values of these variables to the city

3
00:00:16,680 --> 00:00:17,130
request.

4
00:00:17,700 --> 00:00:20,640
Now you can't comment this line.

5
00:00:20,910 --> 00:00:26,520
The news, this city, we request that a variable and as you can see without the variables, you can

6
00:00:26,940 --> 00:00:29,700
actually pass the data directly.

7
00:00:29,970 --> 00:00:38,160
So the API key here is this this is our API key and the sensor is the touch sensor that you already

8
00:00:38,160 --> 00:00:38,640
mentioned.

9
00:00:39,030 --> 00:00:47,100
Its location is at home office and the values one, two and three all of these random values.

10
00:00:47,280 --> 00:00:49,380
This can be used for testing purposes.

11
00:00:49,740 --> 00:00:52,290
You can command this and use this line.

12
00:00:53,100 --> 00:00:54,510
They both work the same.

13
00:00:54,960 --> 00:01:01,320
But if you have problems or if you are suspecting something, you can use this one for testing.

14
00:01:01,980 --> 00:01:07,840
Anyway, I will leave it to you if you wish now to send that to TBE Post request.

15
00:01:07,860 --> 00:01:19,890
We need to create an integer and call it a CBP response code equal ish to TBE Dot post.

16
00:01:21,330 --> 00:01:23,100
Now the post will take.

17
00:01:24,200 --> 00:01:33,710
This variable, the one that we created the data, and it will send it through Vashti TV if you need

18
00:01:33,710 --> 00:01:38,690
honesty because with a content type text or plain, you can change the header.

19
00:01:39,080 --> 00:01:45,890
But this is something I want to recommend because what we are doing here is more advanced.

20
00:01:45,890 --> 00:01:47,240
We are sending variables.

21
00:01:48,050 --> 00:01:57,950
Now I will add other ways to arts and let's say, text or plain text or JSON file to the city we request.

22
00:01:58,350 --> 00:02:06,740
But what we are doing here is simply sending sensor readings and variables so you can stick to the content

23
00:02:06,740 --> 00:02:09,320
header that we created, which is basically an application.

24
00:02:09,990 --> 00:02:12,270
And this is its type w WW.

25
00:02:12,380 --> 00:02:17,420
You are all encoded and this is the encoding part.

26
00:02:19,960 --> 00:02:29,890
Now, to make sure that our city request did go and we don't have any error, we initialize an integer

27
00:02:29,980 --> 00:02:35,350
so that the result of this post request can be stored and this variable.

28
00:02:35,440 --> 00:02:43,630
Now to check this variable, we need to ask using an if statement and else.

29
00:02:45,910 --> 00:02:46,390
Now.

30
00:02:47,490 --> 00:02:48,840
Let's do this.

31
00:02:50,520 --> 00:03:00,360
Now that statement will be if the TB response squad is above zero, this means that we have seen data

32
00:03:00,510 --> 00:03:05,340
and we received a value above zero as a response to the post request.

33
00:03:05,700 --> 00:03:08,100
And that case, we need to print and the serial monitor.

34
00:03:12,200 --> 00:03:19,640
Brent HTP response codes.

35
00:03:23,820 --> 00:03:27,030
And we need to print the code to know if that is an issue.

36
00:03:27,960 --> 00:03:29,970
So I ran.

37
00:03:33,550 --> 00:03:43,390
And now the response quote now, otherwise we need to cover these two, if the value isn't above zero,

38
00:03:43,570 --> 00:03:44,830
means that there is an error.

39
00:03:45,460 --> 00:03:50,140
So in that case, we will use the else and we will say error codes.

40
00:03:52,980 --> 00:03:57,930
Code and words print the same code at the end.

41
00:03:58,140 --> 00:04:00,660
We need to end our requests.

42
00:04:01,930 --> 00:04:04,480
So we need to add A.B. and.

43
00:04:13,120 --> 00:04:17,440
This will end that city request process, and we need to close this.

44
00:04:19,970 --> 00:04:20,330
If.

45
00:04:21,590 --> 00:04:22,100
Now.

46
00:04:23,260 --> 00:04:28,630
Else, as you can see, this is our if statement that we did close.

47
00:04:29,200 --> 00:04:33,190
Now if the Wi-Fi is connected, it will do all of this.

48
00:04:33,340 --> 00:04:45,880
Otherwise, it will print that Wi-Fi is not connected so we can write serial dot, print your line and

49
00:04:45,880 --> 00:04:51,880
we can't simply write life.I disconnected.

50
00:04:55,240 --> 00:05:03,130
After that, we need to make sure that we are not receiving data continuously so.

51
00:05:05,760 --> 00:05:06,640
It's this one.

52
00:05:06,660 --> 00:05:06,980
OK.

53
00:05:07,590 --> 00:05:08,520
We need to either delay.

54
00:05:12,040 --> 00:05:17,610
Plus, thirty thousand milliseconds, which is basically 30 seconds.

55
00:05:18,150 --> 00:05:26,190
So this will tell our ISP to send an assertively post request every 30 seconds to send signals or data.

56
00:05:26,670 --> 00:05:33,560
Now, as I already mentioned, I will post the code, but you have to edit the following lines.

57
00:05:33,630 --> 00:05:38,430
The first thing that you need to edit is versus I.D. and password.

58
00:05:39,640 --> 00:05:44,620
And the second thing that you need to edit is the server name, which is this one.

59
00:05:45,310 --> 00:05:49,210
And you also need to edit the API key.

60
00:05:53,200 --> 00:05:58,690
We did initialize the theater communication for debugging purposes, it's not something you have to

61
00:05:58,690 --> 00:06:02,890
do, but it's a good practice so that you can know if your code has errors.

62
00:06:03,490 --> 00:06:05,710
Now, after doing all of this.

63
00:06:08,220 --> 00:06:10,530
You can verify your code.

64
00:06:10,770 --> 00:06:12,390
We will check it if that is errors.

65
00:06:13,230 --> 00:06:18,360
I will solve them now to make sure that we can upload this code.

66
00:06:19,350 --> 00:06:21,690
OK, now they've said it is in capital.

67
00:06:22,170 --> 00:06:22,560
It's.

68
00:06:25,300 --> 00:06:26,560
I did this OK.

69
00:06:27,190 --> 00:06:35,470
Now I think that we might have some spelling errors because I was writing as I was speaking and explaining.

70
00:06:35,980 --> 00:06:37,030
So this might happen.

71
00:06:39,800 --> 00:06:40,220
OK.

72
00:06:40,250 --> 00:06:41,700
Duncan, bowling great.

73
00:06:41,720 --> 00:06:42,740
We don't have any rules.

74
00:06:43,310 --> 00:06:49,400
Now what you need to do is simply copy the squad and based it on your ISP.

75
00:06:49,850 --> 00:06:57,920
And we are going to do this and the next lesson to test out our coding and to make sure that the server

76
00:06:57,920 --> 00:07:00,260
receives the data and everything's working fine.

77
00:07:00,920 --> 00:07:01,970
That's it for this lesson.

78
00:07:01,970 --> 00:07:04,610
If you have any question, please ask in the Q&amp;A about.

79
00:07:04,910 --> 00:07:05,690
Thanks for watching.

80
00:07:05,720 --> 00:07:08,210
This is Ashraf from educational engineering team.
