1
00:00:01,120 --> 00:00:07,960
Hello, and welcome to this new lesson in which you are going to program SPF 32 using Arduino IDE.

2
00:00:10,340 --> 00:00:17,390
You must have the Arduino I.D. installed and the SPF 30 to add on installed, as we explained in the

3
00:00:17,390 --> 00:00:19,190
download and install section.

4
00:00:20,700 --> 00:00:24,930
Now, after installing the necessary bold add ons, Kobe.

5
00:00:26,080 --> 00:00:36,160
The add on file to our I.D., just as explained, then you can simply open Arduino to start coding.

6
00:00:39,020 --> 00:00:42,890
Now, the first step that we are going to do is.

7
00:00:44,270 --> 00:00:46,970
Create a new file on your sketch.

8
00:00:48,660 --> 00:00:54,930
Now we need to include some libraries, so let's include the Wi-Fi Library.

9
00:01:00,110 --> 00:01:02,570
And we also need to include.

10
00:01:04,600 --> 00:01:06,340
They're TB Client Library.

11
00:01:16,990 --> 00:01:19,180
And we need to include.

12
00:01:20,410 --> 00:01:23,860
Any other labor that we might need for our project for now?

13
00:01:24,190 --> 00:01:25,780
I will just stick with these two.

14
00:01:28,020 --> 00:01:35,710
Now, if you did verify your code, it would ask you to save the code that sustained location.

15
00:01:35,730 --> 00:01:37,650
So here we will save it.

16
00:01:38,490 --> 00:01:42,270
Let's call it USP code.

17
00:01:44,650 --> 00:01:47,830
And sale for here.

18
00:02:01,500 --> 00:02:02,410
Done combining.

19
00:02:02,430 --> 00:02:05,850
Now what you need to do is create a few variables.

20
00:02:06,330 --> 00:02:10,650
We need to create variables for our wireless network credential.

21
00:02:11,160 --> 00:02:17,730
So create a constant character and call it already.

22
00:02:19,320 --> 00:02:24,510
And here you need to enter your network name and by network name is call.

23
00:02:24,600 --> 00:02:25,870
I think I should have TV.

24
00:02:25,910 --> 00:02:28,650
You know the semicolon.

25
00:02:29,490 --> 00:02:31,770
Add another line consistent

26
00:02:34,290 --> 00:02:37,950
character for the password.

27
00:02:41,920 --> 00:02:44,770
And I think my password is this.

28
00:02:49,570 --> 00:02:50,830
Something like that, anyway.

29
00:02:52,780 --> 00:02:53,950
I'll change it later.

30
00:02:54,220 --> 00:02:57,650
Now, let's move on to the ServerName.

31
00:02:58,480 --> 00:03:01,420
Create a constant character.

32
00:03:03,990 --> 00:03:09,810
For the server name and in the server name.

33
00:03:10,080 --> 00:03:18,030
Well, I've got a place I call the domain name, and they are Alberth, all of the IP address with the

34
00:03:18,030 --> 00:03:24,390
birth, depending on your hosting and our case, we need to copy this.

35
00:03:24,900 --> 00:03:32,490
We need the post data filing, which is basically this one.

36
00:03:32,520 --> 00:03:38,730
Okay, let me check this one out of domain name and post that BHP.

37
00:03:39,450 --> 00:03:40,470
So go back here.

38
00:03:40,690 --> 00:03:46,620
Best here tier depending on your domain name, this might be different, but this is what you need to

39
00:03:46,620 --> 00:03:46,920
do.

40
00:03:49,670 --> 00:03:55,400
Now, the next step is creating that API key value.

41
00:03:55,430 --> 00:03:59,030
And we already mentioned that key on the BHP lesson,

42
00:04:03,620 --> 00:04:07,180
and it must be identical to the one you used in your PSP.

43
00:04:08,450 --> 00:04:14,030
And to do so, we will have to open up our PSP code.

44
00:04:17,780 --> 00:04:20,720
And look for the.

45
00:04:21,860 --> 00:04:24,050
API key value.

46
00:04:24,080 --> 00:04:25,110
OK, here it is.

47
00:04:25,640 --> 00:04:33,500
If I value to this one go back copy and based API key value.

48
00:04:34,280 --> 00:04:37,110
Now you can create any other variable that you want.

49
00:04:37,640 --> 00:04:42,020
You can create a variable for the Cinsault name.

50
00:04:44,630 --> 00:04:49,700
Let's call it touch sensor and sense of location.

51
00:04:54,650 --> 00:05:03,950
Let's call it Home Office since we are at home now.

52
00:05:06,150 --> 00:05:16,630
What you need to do is go to the void setup methods and start the serial module at a specific rate.

53
00:05:17,040 --> 00:05:22,020
Let's make it one hundred fifty.

54
00:05:22,320 --> 00:05:23,910
Fifteen thousand two hundred.

55
00:05:25,280 --> 00:05:27,620
Now we need to start the Wi-Fi connection.

56
00:05:28,340 --> 00:05:35,750
Why if I just began using the SSA ID on the password that we used?

57
00:05:36,530 --> 00:05:48,980
After that, we need to plant the serum on a line stating that we are connecting so right connecting

58
00:05:50,270 --> 00:05:53,240
to the Wi-Fi network.

59
00:05:55,850 --> 00:06:05,480
OK, now to make sure that we don't have any errors, we need to check and to print the local IP address

60
00:06:06,170 --> 00:06:08,210
that we get from our I find it work.

61
00:06:08,750 --> 00:06:12,380
So let's add this one statement.

62
00:06:12,860 --> 00:06:19,080
By the way, you can copy the lifecycle from the examples if you want here examples and if you want

63
00:06:19,100 --> 00:06:19,880
the ISP.

64
00:06:20,830 --> 00:06:22,330
You can't simply.

65
00:06:24,310 --> 00:06:25,600
Look for the wife I.

66
00:06:27,470 --> 00:06:32,750
And as you can see here, why fi, if you check the Wi-Fi scan, you can see.

67
00:06:33,870 --> 00:06:35,130
Called for wifey.

68
00:06:37,310 --> 00:06:45,320
And as you can see, if I disconnect white flight mode, you can edit the code or use it.

69
00:06:47,080 --> 00:06:50,680
And now it's checking and printing, that's a.

70
00:06:51,520 --> 00:06:54,370
You can use this code or you can copy our code.

71
00:06:55,090 --> 00:06:56,410
They both work the same.

72
00:06:57,010 --> 00:07:06,040
Now regarding Wi-Fi, but you have to edit them all the codes to allow us to TBE Post and BHP Connection.

73
00:07:06,670 --> 00:07:08,800
Anyway, let's proceed now, though.

74
00:07:08,800 --> 00:07:15,130
I find when you check that the Wi-Fi status.

75
00:07:20,780 --> 00:07:22,160
Wi-Fi connected.

76
00:07:26,820 --> 00:07:33,090
To make sure that we are connected and then we cannot talk, kill the parentheses.

77
00:07:35,700 --> 00:07:39,170
Now between these two kind of emphases, this at some delay

78
00:07:43,170 --> 00:07:50,430
to make sure that we are giving all these people enough time to connect and let's sprint adopt to indicate

79
00:07:50,430 --> 00:07:51,900
that we did reach this point.

80
00:07:59,900 --> 00:08:08,600
OK, now after the wild statement, we can print an empty string.

81
00:08:15,050 --> 00:08:21,500
Then we can't print another line stating that we are connected to the Wi-Fi with a certain IP address

82
00:08:22,130 --> 00:08:24,890
to make sure that we have an IP address.

83
00:08:26,080 --> 00:08:31,280
OK, now why fi is connected

84
00:08:34,700 --> 00:08:38,420
using this IP address

85
00:08:42,980 --> 00:08:52,010
and now to print the IP address and Wi-Fi network, we can use Siri on that trend line and inside it

86
00:08:52,010 --> 00:08:53,440
we need to call wi fi

87
00:08:55,970 --> 00:08:58,370
dot local IP.

88
00:09:02,090 --> 00:09:06,950
So it will print the IP that RSP received.

89
00:09:08,040 --> 00:09:13,680
From the life hereafter now, after doing all of this, we can.

90
00:09:15,530 --> 00:09:22,390
Starred that TB process now to start review process, you need to go to the Void Globe and write a simple

91
00:09:22,520 --> 00:09:31,970
statement inside that if we need to make sure that our Wi-Fi is connected correctly, so we will use

92
00:09:32,210 --> 00:09:36,320
Wi-Fi status equal wireless connected.

93
00:09:40,560 --> 00:09:43,380
Now disconnected what we need right here.

94
00:09:47,160 --> 00:09:49,950
Is first, create an STB.

95
00:09:52,830 --> 00:10:02,190
Client, object and name, it should be now your domain name, who they are, path or IP address must

96
00:10:02,190 --> 00:10:06,140
be passed to the CTP object code using this line.

97
00:10:06,720 --> 00:10:07,690
Look how I began.

98
00:10:09,370 --> 00:10:15,900
And inside it you collect server name, which is basically the server name that we did type here.

99
00:10:19,280 --> 00:10:21,210
Make sure to write it correctly.

100
00:10:21,230 --> 00:10:22,580
We have in capital.

101
00:10:23,810 --> 00:10:24,250
OK.

102
00:10:24,860 --> 00:10:31,280
After that, we need to specify content type header to make sure that we are passing the right values

103
00:10:31,640 --> 00:10:39,320
to our web page, the essential values and other reading, not CTP, dot and header.

104
00:10:39,860 --> 00:10:45,310
This method is the one that you are going to use to send data.

105
00:10:46,940 --> 00:10:47,860
Not one sided.

106
00:10:47,870 --> 00:10:55,700
You need to write content type, then add a column.

107
00:10:57,810 --> 00:11:09,720
And drive this line, fight application slash x w w w form on you are all.

108
00:11:12,820 --> 00:11:17,320
And codes now this line can be found online.

109
00:11:17,740 --> 00:11:23,650
It's easy, and you have to send it before you start fighting that.

110
00:11:25,380 --> 00:11:32,490
Now, the next step is to prepare our FTB request data and the data that we would send in that TV request

111
00:11:32,490 --> 00:11:42,290
is basically the key Typekit iki the sensor location on the sensor name and the value number one value,

112
00:11:42,310 --> 00:11:44,070
number three, two and three.

113
00:11:45,090 --> 00:11:49,440
And these all of these that are will be sent in a string.

114
00:11:49,620 --> 00:12:01,530
So we have to prepare that strings, create a new string quartet TB, request data and start passing

115
00:12:01,530 --> 00:12:02,100
the values.

116
00:12:02,880 --> 00:12:14,340
The first value will be API underscored key and need to a plus sign right API key value.

117
00:12:16,730 --> 00:12:23,270
Which is basically the key value that we did assign at the beginning of our.

118
00:12:24,510 --> 00:12:25,320
Codes here.

119
00:12:28,550 --> 00:12:35,540
Now you need to try the same variables now, plus sign, what we are doing now is we are concatenating

120
00:12:35,570 --> 00:12:38,390
a string with the values that we need to send.

121
00:12:38,840 --> 00:12:48,470
So after that, we need to send the sensor data so we will right and sensor.

122
00:12:52,040 --> 00:12:52,550
Data.

123
00:12:54,780 --> 00:13:01,740
Equal and you are the plus sign and send the.

124
00:13:03,570 --> 00:13:05,880
The variable we've called since your name.

125
00:13:08,910 --> 00:13:18,090
After that, we will send the sense of location you can add on and sign and drive that location

126
00:13:20,700 --> 00:13:21,270
equal.

127
00:13:23,310 --> 00:13:25,980
And we will add since of location.

128
00:13:28,690 --> 00:13:38,980
Here they add another plus sign and start adding different values and value on equal.

129
00:13:41,800 --> 00:13:45,160
And we will add a string.

130
00:13:46,450 --> 00:13:48,050
Let's call it value one.

131
00:13:49,060 --> 00:13:54,970
We can add any other variable here, but since we haven't assigned any variable, we can't seem to right

132
00:13:54,970 --> 00:13:55,570
the value one.

133
00:13:56,890 --> 00:14:00,580
And you can't keep doing this for the other two.

134
00:14:03,510 --> 00:14:03,960
OK.

135
00:14:05,150 --> 00:14:10,580
Now, the value of three for this one value, two for this one.

136
00:14:12,620 --> 00:14:17,210
So it will send value on value to one value three, we can assign variables for this one.

137
00:14:17,750 --> 00:14:20,360
But let's leave them this at this point.

138
00:14:21,360 --> 00:14:23,910
Now after we prepared this request.

139
00:14:25,950 --> 00:14:28,350
As you can see, we need to add a semicolon here,

140
00:14:31,950 --> 00:14:37,260
and we need to add cereal, dot, print

141
00:14:39,930 --> 00:14:40,530
and.

142
00:14:42,070 --> 00:14:47,020
We are going to print, is this story request data?

143
00:14:53,210 --> 00:14:55,130
So let's try it again.

144
00:15:01,300 --> 00:15:03,700
So it will plant the requested that now.

145
00:15:05,050 --> 00:15:09,640
That's it for this lesson, and the next that's not going to proceed with the.

146
00:15:11,000 --> 00:15:19,460
Well, I think our code and making sure that it works for the U.S. people and that it will send data

147
00:15:19,490 --> 00:15:20,390
to our website.

148
00:15:21,440 --> 00:15:22,550
Thanks for watching this lesson.

149
00:15:22,550 --> 00:15:26,630
If you have any question about any line of code, I'm here to help you.

150
00:15:27,110 --> 00:15:27,830
See you next.

151
00:15:28,010 --> 00:15:30,110
This is Ashraf from educational engineering team.
