WEBVTT

1
00:00:00.160 --> 00:00:02.799
<v Speaker 1>Welcome to the deep Dive, the place where we take

2
00:00:02.799 --> 00:00:06.200
<v Speaker 1>your source material and find the most valuable insights just

3
00:00:06.280 --> 00:00:06.519
<v Speaker 1>for you.

4
00:00:07.080 --> 00:00:10.439
<v Speaker 2>And today we're doing a deep dive into these excerpts

5
00:00:10.599 --> 00:00:14.119
<v Speaker 2>from the The Ardueno Cookbook, third Edition. You've given us

6
00:00:14.160 --> 00:00:15.119
<v Speaker 2>quite a collection.

7
00:00:14.800 --> 00:00:19.440
<v Speaker 1>Here, right, a really good stack chapters appendices, covering well

8
00:00:19.519 --> 00:00:22.679
<v Speaker 1>everything from the real basics like programming in math, all

9
00:00:22.679 --> 00:00:28.079
<v Speaker 1>the way up to networking, sensors, motors, sound displays.

10
00:00:27.760 --> 00:00:30.559
<v Speaker 2>And even the really nitty gritty stuff like low level

11
00:00:30.600 --> 00:00:32.960
<v Speaker 2>hardware details and memory optimization.

12
00:00:33.359 --> 00:00:36.280
<v Speaker 1>It's packed, it really is. Think of this deep dive

13
00:00:36.320 --> 00:00:39.079
<v Speaker 1>as your guide, helping you navigate the practical side of

14
00:00:39.119 --> 00:00:42.159
<v Speaker 1>making things with Arduino. We're pulling out the key ideas,

15
00:00:42.159 --> 00:00:45.719
<v Speaker 1>the surprising details from these sources to get you informed fast.

16
00:00:45.799 --> 00:00:48.320
<v Speaker 2>Yeah, the goal seems to be moving beyond just blinking

17
00:00:48.320 --> 00:00:51.479
<v Speaker 2>an led Right, how do you build something interactive, something connected,

18
00:00:51.560 --> 00:00:52.759
<v Speaker 2>something smarter?

19
00:00:53.039 --> 00:00:56.200
<v Speaker 1>Exactly? So we'll explore the programming building blocks, how your

20
00:00:56.240 --> 00:00:58.560
<v Speaker 1>board talks to things, how you sense the world and

21
00:00:58.600 --> 00:01:01.799
<v Speaker 1>make things happen in it, connect online, manage time, and.

22
00:01:01.840 --> 00:01:03.799
<v Speaker 2>Even peek under the hood at the hardware and how

23
00:01:03.840 --> 00:01:05.159
<v Speaker 2>to make your code run efficiently.

24
00:01:05.200 --> 00:01:08.640
<v Speaker 1>Okay, let's unpack this stack. Where do we start foundation?

25
00:01:09.200 --> 00:01:11.159
<v Speaker 1>I guess programming basics.

26
00:01:11.200 --> 00:01:14.280
<v Speaker 2>It makes sense Chapter two parts of the preface ye,

27
00:01:14.400 --> 00:01:18.319
<v Speaker 2>chapter one. Yeah, they all lay this groundwork. And yeah,

28
00:01:18.680 --> 00:01:21.439
<v Speaker 2>it confirms our dueno programming is based on C and

29
00:01:21.480 --> 00:01:22.319
<v Speaker 2>C plus plus nine.

30
00:01:22.359 --> 00:01:24.760
<v Speaker 1>It feels very practical, not theoretical totally.

31
00:01:25.560 --> 00:01:28.079
<v Speaker 2>The focus is immediately on what you need to do,

32
00:01:28.239 --> 00:01:31.200
<v Speaker 2>like that basic sketch structure you always see set.

33
00:01:31.079 --> 00:01:33.599
<v Speaker 1>Up which runs just once right when you power up

34
00:01:33.599 --> 00:01:34.280
<v Speaker 1>a resea.

35
00:01:34.200 --> 00:01:37.799
<v Speaker 2>Exactly, and then loop which just well, loops runs over

36
00:01:37.840 --> 00:01:38.159
<v Speaker 2>and over.

37
00:01:38.319 --> 00:01:40.920
<v Speaker 1>And the sources also mention serial event.

38
00:01:41.400 --> 00:01:44.719
<v Speaker 2>Ah. Yes, that's a handy one. It's a special function

39
00:01:44.719 --> 00:01:47.519
<v Speaker 2>that runs automatically if there's new serial data waiting. Good

40
00:01:47.519 --> 00:01:51.200
<v Speaker 2>for handling incoming messages without constantly checking in your main loop.

41
00:01:51.319 --> 00:01:53.239
<v Speaker 1>But not on all boards you mentioned.

42
00:01:53.000 --> 00:01:56.599
<v Speaker 2>Right, important caveat boards like the Leonardo anything based on

43
00:01:56.640 --> 00:01:58.280
<v Speaker 2>the Ateen Mega three to two AT four, they don't

44
00:01:58.319 --> 00:02:01.079
<v Speaker 2>support serial event in the same way you'd handle cereal

45
00:02:01.120 --> 00:02:01.719
<v Speaker 2>differently there.

46
00:02:01.920 --> 00:02:06.239
<v Speaker 1>Okay, so inside setup and loop you're dealing with data.

47
00:02:06.319 --> 00:02:10.360
<v Speaker 1>The sources introduce data types like INNT and there's a

48
00:02:10.400 --> 00:02:10.879
<v Speaker 1>catch there.

49
00:02:11.000 --> 00:02:13.360
<v Speaker 2>Yeah, this is a good detail. They highlight and int

50
00:02:13.520 --> 00:02:16.120
<v Speaker 2>isn't always the same size. On an HUNO an eight

51
00:02:16.159 --> 00:02:18.919
<v Speaker 2>bit board it's two bytes okay, But on a thirty

52
00:02:18.919 --> 00:02:21.520
<v Speaker 2>two bit board like a SAMD based one, and int

53
00:02:21.599 --> 00:02:23.639
<v Speaker 2>is usually four bytes ah okay.

54
00:02:23.639 --> 00:02:25.680
<v Speaker 1>That could definitely cause problems if you're not expecting it,

55
00:02:25.759 --> 00:02:28.280
<v Speaker 1>especially sending data between different board types.

56
00:02:28.360 --> 00:02:32.039
<v Speaker 2>Precisely, they point out that unsigned short inint is reliably

57
00:02:32.039 --> 00:02:34.680
<v Speaker 2>two bytes on both, which can be useful if you

58
00:02:34.680 --> 00:02:36.000
<v Speaker 2>need a consistent size.

59
00:02:36.159 --> 00:02:40.039
<v Speaker 1>Good tip and for collections of data arrays. The sources

60
00:02:40.039 --> 00:02:42.240
<v Speaker 1>seem pretty insistent about checking array bounds.

61
00:02:42.280 --> 00:02:45.039
<v Speaker 2>Oh, absolutely critical. It's so easy to write code that

62
00:02:45.199 --> 00:02:48.719
<v Speaker 2>accidentally reads or writes past the end of your array.

63
00:02:48.520 --> 00:02:50.039
<v Speaker 1>And the compiler one always warn you.

64
00:02:50.319 --> 00:02:53.439
<v Speaker 2>Often it won't know, and then your sketch just crashes later,

65
00:02:53.759 --> 00:02:57.599
<v Speaker 2>maybe seemingly randomly. It's super frustrating. Using a constant for

66
00:02:57.639 --> 00:03:00.639
<v Speaker 2>the eray size and checking against it is key makes sense.

67
00:03:00.840 --> 00:03:03.479
<v Speaker 1>Then there's text. The book compares our dueno string objects

68
00:03:03.479 --> 00:03:06.560
<v Speaker 1>with C style character arrays. String seems easier.

69
00:03:06.840 --> 00:03:09.639
<v Speaker 2>It is definitely more convenient for like joining text together,

70
00:03:10.080 --> 00:03:12.599
<v Speaker 2>but there's a trade off, especially on boards with limited

71
00:03:12.680 --> 00:03:13.199
<v Speaker 2>RAM like.

72
00:03:13.120 --> 00:03:14.759
<v Speaker 1>The UNO memory issues.

73
00:03:14.919 --> 00:03:18.680
<v Speaker 2>Yeah, string objects can use more memory both flash and RAM,

74
00:03:18.879 --> 00:03:22.120
<v Speaker 2>and worse, heavy use of string manipulation in a complex

75
00:03:22.159 --> 00:03:24.879
<v Speaker 2>sketch can fragment the RAM over time.

76
00:03:25.080 --> 00:03:26.879
<v Speaker 1>Leading to those mysterious crashes.

77
00:03:26.919 --> 00:03:30.560
<v Speaker 2>Again exactly so Sea style character arrays. While needing more

78
00:03:30.599 --> 00:03:33.240
<v Speaker 2>manual handling, you have to manage the memory yourself, can

79
00:03:33.280 --> 00:03:36.280
<v Speaker 2>be much more memory efficient and predictable. They mentioned the

80
00:03:36.280 --> 00:03:39.719
<v Speaker 2>start talk function as an example for parsing Sea style strings.

81
00:03:40.039 --> 00:03:43.199
<v Speaker 1>Good to know the options structuring code is also important.

82
00:03:43.240 --> 00:03:47.520
<v Speaker 2>Functions defining functions, deciding what they return maybe an end,

83
00:03:47.639 --> 00:03:48.560
<v Speaker 2>maybe nothing, void.

84
00:03:48.840 --> 00:03:50.840
<v Speaker 1>What if you need a function to give back like

85
00:03:50.879 --> 00:03:52.039
<v Speaker 1>two or three values.

86
00:03:52.639 --> 00:03:55.199
<v Speaker 2>The practical way, often shown in examples is to have

87
00:03:55.240 --> 00:03:58.159
<v Speaker 2>the function modify global variables rather than trying to return

88
00:03:58.199 --> 00:04:01.520
<v Speaker 2>a complex structure. Maybe but it works.

89
00:04:01.360 --> 00:04:04.719
<v Speaker 1>Okay, then control flowifles switch.

90
00:04:04.599 --> 00:04:08.199
<v Speaker 2>Standard stuff with switch, Remember it needs numeric constants for

91
00:04:08.199 --> 00:04:10.719
<v Speaker 2>the cases, and you must use brake after each case.

92
00:04:10.960 --> 00:04:13.400
<v Speaker 2>Usually otherwise, execution just falls through.

93
00:04:13.199 --> 00:04:16.439
<v Speaker 1>To the next case, ah, right and loops for for

94
00:04:16.600 --> 00:04:17.519
<v Speaker 1>a while yep.

95
00:04:17.560 --> 00:04:21.040
<v Speaker 2>And then operators lots of operators. Your basic math plus

96
00:04:21.079 --> 00:04:23.160
<v Speaker 2>minus times divide.

97
00:04:22.920 --> 00:04:25.759
<v Speaker 1>Increment decrement plus plus plus type. Though the book notes

98
00:04:25.800 --> 00:04:28.879
<v Speaker 1>result result plus one is just as efficient and maybe clearer.

99
00:04:29.000 --> 00:04:31.600
<v Speaker 2>Yeah, result plus plus is common but no real speed

100
00:04:31.639 --> 00:04:35.000
<v Speaker 2>game readability is often better. Then there's modulus.

101
00:04:34.639 --> 00:04:38.519
<v Speaker 1>Percent for remainders useful for checking even nod or wrapping counter.

102
00:04:38.399 --> 00:04:41.480
<v Speaker 2>Super useful, and comparison operators. Yeah, the big one.

103
00:04:41.519 --> 00:04:43.839
<v Speaker 3>Don't mix up it, please don't please don't get if

104
00:04:44.199 --> 00:04:47.519
<v Speaker 3>value five compares value to five, if value five assigns

105
00:04:47.519 --> 00:04:50.279
<v Speaker 3>five to value, and because five is non zero, the

106
00:04:50.360 --> 00:04:52.279
<v Speaker 3>if condition becomes always true.

107
00:04:52.040 --> 00:04:53.800
<v Speaker 1>A nightmare bug defined totally.

108
00:04:53.879 --> 00:04:56.240
<v Speaker 2>Then logical operators in A and D or candy for

109
00:04:56.279 --> 00:04:57.639
<v Speaker 2>combining conditions.

110
00:04:57.240 --> 00:05:00.199
<v Speaker 1>And bitwise operators for fiddling with individual.

111
00:04:59.759 --> 00:05:03.720
<v Speaker 2>Bits right and and dan. But often the helper functions

112
00:05:03.759 --> 00:05:07.519
<v Speaker 2>are easier bitrid bitright, bitset, bit clear, bit much more readable.

113
00:05:07.639 --> 00:05:11.800
<v Speaker 1>Good point operator precedents use parentheses to be sure.

114
00:05:11.759 --> 00:05:14.959
<v Speaker 2>Always good advice, and the book mentions garbage in garbage out.

115
00:05:15.160 --> 00:05:18.800
<v Speaker 2>Check your inputs even if example, skip it for brevity. Also,

116
00:05:19.199 --> 00:05:21.240
<v Speaker 2>watch out for variable overflow.

117
00:05:21.000 --> 00:05:23.759
<v Speaker 1>Where a calculation result is too big for the variable type.

118
00:05:23.920 --> 00:05:26.680
<v Speaker 2>Yep, the ide might not warn you unless you turn

119
00:05:26.759 --> 00:05:31.040
<v Speaker 2>warnings way up. For constants, const is better than hashtag define.

120
00:05:31.600 --> 00:05:34.600
<v Speaker 2>Why's that? Because const variables have a type so the

121
00:05:34.600 --> 00:05:37.839
<v Speaker 2>compiler can check if you're using them correctly. Hashtag define

122
00:05:37.920 --> 00:05:41.720
<v Speaker 2>is just text replacement basically, Plus the compiler often optimizes

123
00:05:41.759 --> 00:05:43.639
<v Speaker 2>constvarrables away if they aren't needed.

124
00:05:43.759 --> 00:05:47.959
<v Speaker 1>Smart Lastly, on basics, board variations matter. Three point three

125
00:05:48.040 --> 00:05:48.839
<v Speaker 1>V versus.

126
00:05:48.639 --> 00:05:51.480
<v Speaker 2>Five V huge difference, and not just voltage but pin

127
00:05:51.600 --> 00:05:54.680
<v Speaker 2>current limits. An UDO pin might handle forty million amps,

128
00:05:54.839 --> 00:05:56.959
<v Speaker 2>but a thirty two bit board pin might only handle

129
00:05:57.000 --> 00:05:57.720
<v Speaker 2>seven million amps.

130
00:05:57.800 --> 00:05:59.800
<v Speaker 1>So you can't just drive an LED directly from any

131
00:06:00.199 --> 00:06:00.839
<v Speaker 1>on any board.

132
00:06:00.920 --> 00:06:03.160
<v Speaker 2>Nope, you have to check the SVATA sheet and form

133
00:06:03.199 --> 00:06:08.319
<v Speaker 2>factors differ too, UNO MKR, Nano zero effcshield compatibility. Lots

134
00:06:08.319 --> 00:06:09.199
<v Speaker 2>of practical details.

135
00:06:09.279 --> 00:06:12.160
<v Speaker 1>Okay, solid foundation. Now how do these boards actually talk

136
00:06:12.199 --> 00:06:15.240
<v Speaker 1>to things? Cereal I two CSBI right, Chapter four.

137
00:06:15.160 --> 00:06:17.759
<v Speaker 2>And thirteen get into this. Cereal is kind of the workhorse.

138
00:06:18.360 --> 00:06:21.639
<v Speaker 2>Flexible talks to computers other devices.

139
00:06:21.319 --> 00:06:24.480
<v Speaker 1>Usually over that USB connection, which also uploads the sketch.

140
00:06:24.600 --> 00:06:27.959
<v Speaker 2>Yep, you start with serial dot begin setting the BOD right, Yeah,

141
00:06:28.160 --> 00:06:31.519
<v Speaker 2>crucial step both ends must match speed or yeah gibberish

142
00:06:31.720 --> 00:06:35.279
<v Speaker 2>just random characters. Yeah, Then cerreal dot print or serial

143
00:06:35.399 --> 00:06:39.759
<v Speaker 2>dot print to send data. A check serial dot available

144
00:06:39.759 --> 00:06:42.199
<v Speaker 2>to see if data has arrived, then Cereal dot read

145
00:06:42.279 --> 00:06:45.639
<v Speaker 2>to get a byte or serial dot parsit serial dot

146
00:06:45.639 --> 00:06:46.959
<v Speaker 2>parse float for numbers.

147
00:06:47.040 --> 00:06:49.160
<v Speaker 1>You need to decide how to structure the data right

148
00:06:49.319 --> 00:06:51.040
<v Speaker 1>text versus binary exactly.

149
00:06:51.079 --> 00:06:53.879
<v Speaker 2>Text is easier to debug, maybe use commas as dilimiters.

150
00:06:54.240 --> 00:06:56.720
<v Speaker 2>Binary is more compact, but you really need to know

151
00:06:56.759 --> 00:06:59.680
<v Speaker 2>the data types on both ends. Functions like low byte

152
00:06:59.720 --> 00:07:02.120
<v Speaker 2>and i bite help with multibyte values.

153
00:07:02.199 --> 00:07:05.560
<v Speaker 1>The IDEs Serial monitor and serial quatter are useful.

154
00:07:05.199 --> 00:07:09.279
<v Speaker 2>Here absolutely monitor for text, plotter for graphing numbers, visually

155
00:07:09.279 --> 00:07:12.040
<v Speaker 2>great for sensors. And there are other terminal programs too,

156
00:07:12.079 --> 00:07:12.639
<v Speaker 2>like qute com.

157
00:07:12.800 --> 00:07:15.079
<v Speaker 1>What if you need more serial ports than the board has,

158
00:07:15.240 --> 00:07:17.680
<v Speaker 1>like on a MOOO, That's where software Cereal comes in.

159
00:07:17.800 --> 00:07:20.160
<v Speaker 2>It's a library that lets you use other digital pins

160
00:07:20.480 --> 00:07:23.560
<v Speaker 2>to simulate a serial port. Not as fast or reliable

161
00:07:23.560 --> 00:07:27.000
<v Speaker 2>as hardware Cereal, but a life saver. Sometimes boards like

162
00:07:27.040 --> 00:07:30.639
<v Speaker 2>the Mega or newer ARM boards often have multiple hardware

163
00:07:30.639 --> 00:07:31.600
<v Speaker 2>serial ports built in.

164
00:07:31.720 --> 00:07:34.959
<v Speaker 1>Okay, moving from talking to the computer to talking between chips.

165
00:07:35.360 --> 00:07:39.399
<v Speaker 2>I two C integrated circuit great protocol uses just two

166
00:07:39.399 --> 00:07:42.759
<v Speaker 2>wires SDA and SEL plus power and ground. You can

167
00:07:42.800 --> 00:07:44.879
<v Speaker 2>connect multiple devices to those same two wires.

168
00:07:44.879 --> 00:07:45.680
<v Speaker 1>How does that work?

169
00:07:45.759 --> 00:07:49.120
<v Speaker 2>Each device needs a unique address. The arduino acts as

170
00:07:49.160 --> 00:07:51.920
<v Speaker 2>the master and it addresses the specific slave device it

171
00:07:51.959 --> 00:07:54.279
<v Speaker 2>wants to talk to, like maybe a sensor A address

172
00:07:54.360 --> 00:07:55.160
<v Speaker 2>serial by five.

173
00:07:55.000 --> 00:07:57.160
<v Speaker 1>A using the wire library YEP.

174
00:07:57.199 --> 00:08:00.240
<v Speaker 2>Wired up begin transmission, wired dot write, wired up in

175
00:08:00.360 --> 00:08:03.480
<v Speaker 2>transmission to send wired dot request FROUM, and wired dot

176
00:08:03.600 --> 00:08:07.680
<v Speaker 2>read to receive sound straightforward. Any catches voltage levels. If

177
00:08:07.720 --> 00:08:09.439
<v Speaker 2>you have a five VR duino and a three point

178
00:08:09.519 --> 00:08:12.439
<v Speaker 2>three v I two C sensor, you absolutely need a

179
00:08:12.439 --> 00:08:15.279
<v Speaker 2>logic level shifter between them, otherwise you risk frying the sensor.

180
00:08:15.360 --> 00:08:18.439
<v Speaker 1>Ah, good warning. The examples show reading e proms connecting

181
00:08:18.480 --> 00:08:20.000
<v Speaker 1>our duenos, even a we nunchuck.

182
00:08:20.120 --> 00:08:22.480
<v Speaker 2>Yeah, the nunchuck uses it two C for its accelerometer.

183
00:08:22.800 --> 00:08:23.600
<v Speaker 2>Cool example.

184
00:08:23.680 --> 00:08:27.240
<v Speaker 1>Okay, then there's SPI Serial peripheral interface.

185
00:08:26.959 --> 00:08:30.160
<v Speaker 2>Right, often faster than it. Two C uses four main

186
00:08:30.240 --> 00:08:34.440
<v Speaker 2>lines Mosai, MISO, SCK and ss or cs.

187
00:08:34.159 --> 00:08:36.600
<v Speaker 1>Master out, slave in, master and slave out, clock and

188
00:08:36.679 --> 00:08:37.919
<v Speaker 1>slave select exactly.

189
00:08:38.279 --> 00:08:41.080
<v Speaker 2>MOSAI and MESA are separate data lines, which helps the speed.

190
00:08:41.600 --> 00:08:43.000
<v Speaker 2>SCK is the clock signal.

191
00:08:43.159 --> 00:08:45.200
<v Speaker 1>How do multiple SPI devices work?

192
00:08:45.360 --> 00:08:48.960
<v Speaker 2>They share Mosai, MISO and SEK, but each slave device

193
00:08:49.039 --> 00:08:52.720
<v Speaker 2>needs its own dedicated slave select SS or JIP select

194
00:08:52.879 --> 00:08:55.279
<v Speaker 2>cspin controlled by the arduino, So.

195
00:08:55.240 --> 00:08:57.840
<v Speaker 1>The arduena pulls one CS line low to talk to

196
00:08:57.879 --> 00:08:59.600
<v Speaker 1>that specific device precisely.

197
00:08:59.720 --> 00:09:01.840
<v Speaker 2>The example of using an SD card reader and a

198
00:09:01.879 --> 00:09:05.279
<v Speaker 2>TFT display together illustrates this well. Both my use SPI.

199
00:09:05.519 --> 00:09:07.440
<v Speaker 2>They share the main three lines, but you need two

200
00:09:07.559 --> 00:09:10.240
<v Speaker 2>separate Arduino pins for their individual CS lines.

201
00:09:10.320 --> 00:09:12.559
<v Speaker 1>Got it. Okay, we know how to program, how communicate.

202
00:09:12.639 --> 00:09:14.960
<v Speaker 1>Now let's get our hands dirty interacting with the physical

203
00:09:14.960 --> 00:09:16.720
<v Speaker 1>world inputs and outputs.

204
00:09:16.799 --> 00:09:18.679
<v Speaker 2>Yeah, this is where it gets fun. Chapters five through

205
00:09:18.720 --> 00:09:22.159
<v Speaker 2>eleven cover this, starting with inputs digital and analog.

206
00:09:22.519 --> 00:09:25.639
<v Speaker 1>Digital is just high or low voltage right.

207
00:09:26.159 --> 00:09:30.159
<v Speaker 2>Digital read after setting the pin with pin mode pin

208
00:09:30.440 --> 00:09:34.360
<v Speaker 2>I nput and remember the voltage level for HGH differs

209
00:09:34.399 --> 00:09:36.120
<v Speaker 2>between three point three V and five.

210
00:09:36.039 --> 00:09:38.240
<v Speaker 1>V boards, and analog is analog.

211
00:09:38.320 --> 00:09:41.320
<v Speaker 2>Reed reads a voltage on an analog input pin and

212
00:09:41.360 --> 00:09:43.919
<v Speaker 2>converts it to a number, usually zero to kenna to

213
00:09:43.919 --> 00:09:48.159
<v Speaker 2>twenty three. Unos have six analog pins, megas have sixteen.

214
00:09:48.320 --> 00:09:51.440
<v Speaker 1>The book covers common inputs like switches potentiometers.

215
00:09:51.480 --> 00:09:54.840
<v Speaker 2>Potentiometers are great examples of analog input and voltage division.

216
00:09:55.360 --> 00:09:58.960
<v Speaker 2>Also photo resistors light sensors that change resistance. You need

217
00:09:59.000 --> 00:10:01.799
<v Speaker 2>a fixed resistor with to create a voltage divider circuit.

218
00:10:01.919 --> 00:10:04.799
<v Speaker 2>Microphones too, Yeah, electro microphone breakouts. You read them with

219
00:10:04.879 --> 00:10:06.840
<v Speaker 2>an analog read but you need to account for the

220
00:10:06.919 --> 00:10:09.960
<v Speaker 2>DC offset in the signal temperature sensors like the analog

221
00:10:10.039 --> 00:10:13.080
<v Speaker 2>TMP thirty six or the digital DS eighteen B twenty

222
00:10:13.080 --> 00:10:16.240
<v Speaker 2>which uses a different protocol called one wire and GPS modules,

223
00:10:16.279 --> 00:10:19.320
<v Speaker 2>those usually communicate over cereal sending streams of text data.

224
00:10:19.399 --> 00:10:23.360
<v Speaker 2>Libraries like tiny GPS plus make parsing that data much easier.

225
00:10:23.399 --> 00:10:26.279
<v Speaker 1>What about needing more analog inputs than the board has

226
00:10:26.720 --> 00:10:27.639
<v Speaker 1>clever trick.

227
00:10:28.000 --> 00:10:30.879
<v Speaker 2>Use a multiplexer chip like the forty five to one

228
00:10:31.039 --> 00:10:34.759
<v Speaker 2>unless you switch one analog pin between multiple inputs. The

229
00:10:34.759 --> 00:10:38.240
<v Speaker 2>book also shows measuring higher voltages using a voltage divider

230
00:10:38.240 --> 00:10:41.320
<v Speaker 2>circuit and calculating the actual voltage and reading IR remote

231
00:10:41.360 --> 00:10:43.519
<v Speaker 2>controls using the I Remote library.

232
00:10:43.240 --> 00:10:46.159
<v Speaker 1>Cool now outputs making things happen.

233
00:10:46.600 --> 00:10:50.000
<v Speaker 2>LED's first the classic, but watch that pin current limit

234
00:10:50.039 --> 00:10:53.559
<v Speaker 2>we mentioned forty mari on Uno, maybe only seven marry

235
00:10:53.600 --> 00:10:57.279
<v Speaker 2>out another's for bright LEDs or lots of immunia transistor

236
00:10:57.360 --> 00:10:59.320
<v Speaker 2>or moss fat to handle the current.

237
00:10:59.440 --> 00:11:03.200
<v Speaker 1>What about those fancy addressable LEDs NeoPixels very popular?

238
00:11:03.320 --> 00:11:05.559
<v Speaker 2>Use a library like a to fruit NeoPixel. You tell

239
00:11:05.559 --> 00:11:07.639
<v Speaker 2>each pixel what color it should be, then call the

240
00:11:07.679 --> 00:11:09.600
<v Speaker 2>show function to update the whole strip at once.

241
00:11:09.639 --> 00:11:12.559
<v Speaker 1>They mention things like color HSV and gamma thirty two.

242
00:11:12.639 --> 00:11:15.559
<v Speaker 2>Yeah, color HSV gives you HU saturation value control, which

243
00:11:15.600 --> 00:11:18.600
<v Speaker 2>could be more intuitive than RGB sometimes, and gamma thirty

244
00:11:18.639 --> 00:11:20.919
<v Speaker 2>two corrects the brightness so colors look more natural to

245
00:11:20.960 --> 00:11:24.679
<v Speaker 2>our eyes. Big consideration power Lots of new epixels need

246
00:11:24.720 --> 00:11:25.960
<v Speaker 2>a separate BF power supply.

247
00:11:26.159 --> 00:11:29.840
<v Speaker 1>Okay, what about LED matrices? Lots of simple LEDs.

248
00:11:29.799 --> 00:11:33.039
<v Speaker 2>Use techniques like multiplexing or Charlie plexing to control many

249
00:11:33.159 --> 00:11:36.679
<v Speaker 2>LEDs with fewer pins. The book explains the concepts and wiring.

250
00:11:36.799 --> 00:11:40.159
<v Speaker 2>It can get complex, especially animating Charlie plex displays and

251
00:11:40.240 --> 00:11:42.360
<v Speaker 2>multiplexing can draw a surprising amount of power.

252
00:11:42.399 --> 00:11:45.200
<v Speaker 1>Sometimes seven segment displays for numbers.

253
00:11:45.000 --> 00:11:49.159
<v Speaker 2>Yep again often multiplexed. Understanding common cathode versus common and

254
00:11:49.279 --> 00:11:52.000
<v Speaker 2>ode is key, but using an I two C driver

255
00:11:52.159 --> 00:11:55.039
<v Speaker 2>chip like the HT sixteen K thirty three makes it

256
00:11:55.120 --> 00:11:55.720
<v Speaker 2>much simpler.

257
00:11:55.799 --> 00:11:59.480
<v Speaker 1>Just two wires plus power moving Beyond simple lights, displays

258
00:11:59.559 --> 00:12:00.799
<v Speaker 1>like LCA.

259
00:12:00.480 --> 00:12:04.279
<v Speaker 2>Text LCDs are common. Use the Liquid Crystal library, print text,

260
00:12:04.399 --> 00:12:07.600
<v Speaker 2>set the curser position scroll. You can even create custom characters.

261
00:12:07.639 --> 00:12:10.799
<v Speaker 1>What about graphical displays olds color LCDs.

262
00:12:10.879 --> 00:12:13.159
<v Speaker 2>They offer much more detail, but yet more complex wiring.

263
00:12:13.279 --> 00:12:16.039
<v Speaker 2>Usually monochrome O leads often use I two C or

264
00:12:16.120 --> 00:12:19.679
<v Speaker 2>SPI libraries like Adafruit SSD one three zero six are common.

265
00:12:20.080 --> 00:12:23.240
<v Speaker 2>Color LCDs typically use SPI like the ST seven seven

266
00:12:23.360 --> 00:12:26.159
<v Speaker 2>seven three five or ST seven seven eight nine. Types. Again,

267
00:12:26.200 --> 00:12:27.600
<v Speaker 2>with dedicated libraries, is.

268
00:12:27.519 --> 00:12:29.519
<v Speaker 1>It hard to switch between display types?

269
00:12:29.960 --> 00:12:32.759
<v Speaker 2>Sometimes not. Adafruit, for instance, tries to keep their graphics

270
00:12:32.799 --> 00:12:35.399
<v Speaker 2>library APIs similar, which helps. The main trade off is

271
00:12:35.440 --> 00:12:40.320
<v Speaker 2>often monochrome versus color, cost, memory usage, power draw okay.

272
00:12:40.159 --> 00:12:42.159
<v Speaker 1>Visual output covered. Let's make things move.

273
00:12:42.559 --> 00:12:46.159
<v Speaker 2>Servos easiest way to get precise rotational movement. Use the

274
00:12:46.200 --> 00:12:48.960
<v Speaker 2>Serbo library attached to a pin tell at an angle

275
00:12:48.960 --> 00:12:49.960
<v Speaker 2>with Servo dot write.

276
00:12:50.159 --> 00:12:53.159
<v Speaker 1>Simple scoops are easy, but there was a timer conflict warning.

277
00:12:53.399 --> 00:12:57.279
<v Speaker 2>Uh yes, good catch on the un The servil library

278
00:12:57.360 --> 00:13:00.519
<v Speaker 2>uses Timer one. Dot analog rite on pins No. Ten

279
00:13:00.720 --> 00:13:03.840
<v Speaker 2>also uses Timer one, so you can't use servos NPWM

280
00:13:03.879 --> 00:13:06.799
<v Speaker 2>on those specific bins at the same time hardware limitation.

281
00:13:07.000 --> 00:13:10.279
<v Speaker 1>Good to know DC motors like in Little Robots.

282
00:13:10.000 --> 00:13:12.799
<v Speaker 2>Right, They need more power than an Ardueno pin can supply,

283
00:13:13.120 --> 00:13:15.720
<v Speaker 2>and you usually want to control direction too, so you

284
00:13:15.799 --> 00:13:19.200
<v Speaker 2>need external drivers transistors for simple on off or h

285
00:13:19.279 --> 00:13:21.240
<v Speaker 2>bridges like the L two ninety three or L two

286
00:13:21.279 --> 00:13:24.720
<v Speaker 2>ninety eight for speed and direction control using PWM motor

287
00:13:24.759 --> 00:13:26.039
<v Speaker 2>shields bundle this up neatly.

288
00:13:26.159 --> 00:13:29.120
<v Speaker 1>The book shows controlling motors based on sensors, yeah, like.

289
00:13:29.120 --> 00:13:31.720
<v Speaker 2>Using photo resistors to make a simple light following robot.

290
00:13:31.879 --> 00:13:35.799
<v Speaker 1>Classic project stepper motors for more precise positioning.

291
00:13:36.679 --> 00:13:40.440
<v Speaker 2>Often driven using dedicated driver boards like the Easy Driver

292
00:13:40.600 --> 00:13:44.039
<v Speaker 2>for bipolar steppers. The duino tills the driver the direction

293
00:13:44.159 --> 00:13:46.840
<v Speaker 2>and when to step, and the driver handles the tricky

294
00:13:46.879 --> 00:13:50.559
<v Speaker 2>coil energizing sequences. You might not even need the standard

295
00:13:50.600 --> 00:13:52.000
<v Speaker 2>stepper library with that approach.

296
00:13:52.320 --> 00:13:53.759
<v Speaker 1>Interesting. What about sound?

297
00:13:54.440 --> 00:13:58.159
<v Speaker 2>Simplest way is the tone function. Connect a speaker or

298
00:13:58.159 --> 00:14:01.120
<v Speaker 2>piezo buzzer to a digital pin, give it a frequency

299
00:14:01.120 --> 00:14:02.519
<v Speaker 2>in duration beep.

300
00:14:02.679 --> 00:14:03.759
<v Speaker 1>Can you play melodies?

301
00:14:03.799 --> 00:14:06.519
<v Speaker 2>Sure? Store the note frequencies and durations in a raise,

302
00:14:06.879 --> 00:14:09.720
<v Speaker 2>then loop through them using tone. The book even shows

303
00:14:09.759 --> 00:14:12.440
<v Speaker 2>generating tones with more precise microsecond timing.

304
00:14:12.720 --> 00:14:14.440
<v Speaker 1>MIDI output two YEP.

305
00:14:14.320 --> 00:14:17.480
<v Speaker 2>Sending many messages out the serial TX pin. Just remember

306
00:14:17.519 --> 00:14:20.480
<v Speaker 2>to disconnect anything connected to pin one TX when you

307
00:14:20.519 --> 00:14:22.679
<v Speaker 2>upload a new sketch, otherwise the uproad.

308
00:14:22.440 --> 00:14:25.360
<v Speaker 1>Might fail and complex sounds the odd winosketch.

309
00:14:25.440 --> 00:14:28.799
<v Speaker 2>Ah yeah, that's a NEAT one, a software synthesizer using

310
00:14:28.799 --> 00:14:32.240
<v Speaker 2>potentiometers for control, but the sources mentioned is likely only

311
00:14:32.279 --> 00:14:34.960
<v Speaker 2>for eight bit boards like the UNO. A good reminder

312
00:14:34.960 --> 00:14:37.399
<v Speaker 2>that some low level code isn't easily portable.

313
00:14:37.559 --> 00:14:40.799
<v Speaker 1>So much interaction, but timing is crucial for.

314
00:14:40.840 --> 00:14:44.639
<v Speaker 2>Orchestrating all this absolutely to chapter twelve and eighteen, focus

315
00:14:44.639 --> 00:14:49.240
<v Speaker 2>on time. The basic pause is delay stops everything for milliseconds,

316
00:14:49.440 --> 00:14:51.799
<v Speaker 2>delay microseconds for shorter pauses.

317
00:14:51.840 --> 00:14:52.919
<v Speaker 1>There's also a pulse.

318
00:14:52.759 --> 00:14:56.480
<v Speaker 2>Ent yeah, for measuring how long a digital pulse. Lasts useful,

319
00:14:56.600 --> 00:14:59.039
<v Speaker 2>but it has limitations on the range and accuracy of

320
00:14:59.080 --> 00:15:00.440
<v Speaker 2>pulses that can bear reliably.

321
00:15:00.559 --> 00:15:03.480
<v Speaker 1>But delay stops everything, right, that's often bad.

322
00:15:03.720 --> 00:15:07.000
<v Speaker 2>It often is. That's why the milli's function is so important.

323
00:15:07.120 --> 00:15:09.600
<v Speaker 2>It returns the number of milliseconds since the board started.

324
00:15:10.080 --> 00:15:11.919
<v Speaker 2>Use it for non blocking timing, like.

325
00:15:11.840 --> 00:15:13.240
<v Speaker 1>The blink without delay example.

326
00:15:13.440 --> 00:15:16.399
<v Speaker 2>Exactly check the current millise, compare it to when the

327
00:15:16.440 --> 00:15:18.919
<v Speaker 2>last action happened, and if enough time has passed, do

328
00:15:19.000 --> 00:15:21.759
<v Speaker 2>the action again and record the new time. This lets

329
00:15:21.799 --> 00:15:26.440
<v Speaker 2>your loop keep running quickly, checking sensors, handlink communication, and

330
00:15:26.519 --> 00:15:28.879
<v Speaker 2>blinking the LED seemingly all at once.

331
00:15:29.080 --> 00:15:31.600
<v Speaker 1>Much better. What about scheduling tasks for later?

332
00:15:31.960 --> 00:15:34.159
<v Speaker 2>The time and time alarms libraries are great for that.

333
00:15:34.519 --> 00:15:37.840
<v Speaker 2>You can set alarms to trigger functions once time once

334
00:15:38.159 --> 00:15:41.080
<v Speaker 2>or repeatedly time repeat any catches. You must call alarm

335
00:15:41.159 --> 00:15:44.440
<v Speaker 2>dot delay frequently in your loop. That's the function that

336
00:15:44.480 --> 00:15:46.679
<v Speaker 2>actually checks if any alarms are due. If you don't

337
00:15:46.679 --> 00:15:48.759
<v Speaker 2>call it, your alarms won't fire, and there's usually a

338
00:15:48.799 --> 00:15:50.639
<v Speaker 2>limit to how many alarms you can have active, like

339
00:15:50.679 --> 00:15:52.399
<v Speaker 2>six on AVR boards by default.

340
00:15:52.440 --> 00:15:56.080
<v Speaker 1>Okay. The book also mentions hardware timers under the hood.

341
00:15:56.240 --> 00:15:59.399
<v Speaker 2>Yeah, the micro controller ship itself has dedicated hardware timers. Yeah.

342
00:16:00.039 --> 00:16:03.200
<v Speaker 2>On the UNO's eighty Mega three twenty eight timers zero

343
00:16:03.320 --> 00:16:07.159
<v Speaker 2>is used by Millie's delay and PWM on pins five

344
00:16:07.159 --> 00:16:10.559
<v Speaker 2>to six. Timer one is for PWM on pins nine

345
00:16:10.600 --> 00:16:13.960
<v Speaker 2>to ten, and the SERVERO Library Tier II is PWM

346
00:16:14.000 --> 00:16:15.200
<v Speaker 2>on pins three eleven.

347
00:16:15.440 --> 00:16:18.399
<v Speaker 1>Ah, So that's the hardware reason for the servo PWM

348
00:16:18.399 --> 00:16:21.200
<v Speaker 1>conflict on pins nine to ten. They both need timer

349
00:16:21.240 --> 00:16:22.039
<v Speaker 1>one exactly.

350
00:16:22.679 --> 00:16:25.639
<v Speaker 2>Knowing this helps diagnose weird issues. You can even manipulate

351
00:16:25.639 --> 00:16:29.039
<v Speaker 2>the timer registers directly for super precise PWM or timing,

352
00:16:29.279 --> 00:16:30.320
<v Speaker 2>but that's getting advanced.

353
00:16:30.360 --> 00:16:32.879
<v Speaker 1>There was also something about faster analog reads.

354
00:16:33.120 --> 00:16:36.159
<v Speaker 2>Right, you can change the ADC analog to digital converter

355
00:16:36.279 --> 00:16:38.799
<v Speaker 2>clock speed standard and allogreed takes about one hundred and

356
00:16:38.840 --> 00:16:41.320
<v Speaker 2>ten microseconds. By tweaking a register, you can get it

357
00:16:41.360 --> 00:16:44.320
<v Speaker 2>down to maybe seventeen microseconds on a sixteen megawords board.

358
00:16:44.440 --> 00:16:47.559
<v Speaker 1>Wow, that's a huge speed up, useful for audio, perfect for.

359
00:16:47.519 --> 00:16:51.360
<v Speaker 2>Things like audio sampling or capturing other fast changing signals.

360
00:16:51.399 --> 00:16:53.159
<v Speaker 1>And the Watchdog timer for sleep YEP.

361
00:16:53.600 --> 00:16:56.440
<v Speaker 2>It's mainly designed to reset the board if the code hangs,

362
00:16:56.879 --> 00:16:58.440
<v Speaker 2>but you can also use it to put the board

363
00:16:58.440 --> 00:17:01.320
<v Speaker 2>into a low power sleep for sure fixed periods fifteen

364
00:17:01.360 --> 00:17:04.920
<v Speaker 2>milliseconds up to eight seconds. You can loop these sleeps

365
00:17:04.920 --> 00:17:06.599
<v Speaker 2>for longer low power delays.

366
00:17:06.920 --> 00:17:12.279
<v Speaker 1>Okay, we've got code communication IO timing. Yeah, what about

367
00:17:12.279 --> 00:17:15.920
<v Speaker 1>connecting to the big wide world? Wi Fi and Ethernet?

368
00:17:16.079 --> 00:17:20.319
<v Speaker 2>Chapter fifteen territory opens up huge possibilities. Ethernet is wired

369
00:17:20.400 --> 00:17:23.039
<v Speaker 2>Wi Fi is wireless need specific hardware, of.

370
00:17:23.039 --> 00:17:26.039
<v Speaker 1>Course, like an Ethernet shield or boards with built in

371
00:17:26.079 --> 00:17:27.240
<v Speaker 1>Wi Fi exactly.

372
00:17:27.400 --> 00:17:30.519
<v Speaker 2>Libraries like Ethernet or waifena handle the low level stuff.

373
00:17:30.720 --> 00:17:33.720
<v Speaker 2>The super cheap espaight to sixty six modules are also mentioned,

374
00:17:33.720 --> 00:17:36.640
<v Speaker 2>amazing value for adding Wi Fi, though maybe a bit

375
00:17:36.640 --> 00:17:38.920
<v Speaker 2>more fiddly to get started with programming them initially.

376
00:17:39.279 --> 00:17:41.759
<v Speaker 1>So Ardno can be a client or a server on

377
00:17:41.799 --> 00:17:44.079
<v Speaker 1>the network. What does being a client involve?

378
00:17:44.200 --> 00:17:48.519
<v Speaker 2>Initiating connections? Sending simple UDP messages for example, or very

379
00:17:48.559 --> 00:17:51.160
<v Speaker 2>commonly acting like a web client, making requests to web

380
00:17:51.200 --> 00:17:51.680
<v Speaker 2>servers to.

381
00:17:51.599 --> 00:17:54.920
<v Speaker 1>Get data like fetching weather data or stock prices.

382
00:17:54.759 --> 00:17:57.880
<v Speaker 2>Or the example in the book getting the current location

383
00:17:57.960 --> 00:18:00.519
<v Speaker 2>of the International Space Station from the open Notify API.

384
00:18:01.240 --> 00:18:04.440
<v Speaker 2>The key is making the request and then parsing the response.

385
00:18:04.079 --> 00:18:06.960
<v Speaker 1>You get back extracting the actual numbers or texts you

386
00:18:07.000 --> 00:18:09.160
<v Speaker 1>need from the HTML or JSON right.

387
00:18:09.400 --> 00:18:13.440
<v Speaker 2>The book shows examples for strings, floats, iNTS. It also

388
00:18:13.480 --> 00:18:18.000
<v Speaker 2>covers requesting XML data, sending data using HTTP post like

389
00:18:18.039 --> 00:18:21.359
<v Speaker 2>filling out a web form, and getting the time using NTP,

390
00:18:21.640 --> 00:18:25.000
<v Speaker 2>even sending tweets YEP, usually via a proxy service like

391
00:18:25.039 --> 00:18:28.839
<v Speaker 2>think speak that handles the authentication and for IoT stuff,

392
00:18:28.960 --> 00:18:29.839
<v Speaker 2>MQTT is.

393
00:18:29.880 --> 00:18:32.319
<v Speaker 1>Key message queuing telemetry transport.

394
00:18:32.519 --> 00:18:36.079
<v Speaker 2>That's the one. Using a library like pubsubclient, your Arduino

395
00:18:36.119 --> 00:18:38.839
<v Speaker 2>can publish data like sensor readings to a central broker

396
00:18:39.279 --> 00:18:41.759
<v Speaker 2>or subscribe to topics to receive commands or data from

397
00:18:41.799 --> 00:18:44.000
<v Speaker 2>other devices. Very efficient for IoT.

398
00:18:44.240 --> 00:18:46.079
<v Speaker 1>Okay, what about acting as a server.

399
00:18:46.000 --> 00:18:49.359
<v Speaker 2>That means your Dueno listens for incoming connections. Most common

400
00:18:49.400 --> 00:18:52.119
<v Speaker 2>is setting it up as a web server using the relevant.

401
00:18:51.759 --> 00:18:54.119
<v Speaker 1>Library, so you could type its IP address into a

402
00:18:54.119 --> 00:18:56.279
<v Speaker 1>browser and see a page exactly.

403
00:18:56.839 --> 00:18:59.960
<v Speaker 2>Your Dueno sketch handles the incoming request, figures out what

404
00:19:00.039 --> 00:19:03.119
<v Speaker 2>page was asked for, and sends back HTML to the browser.

405
00:19:03.759 --> 00:19:06.640
<v Speaker 1>Could you control Arduino pins from that web page?

406
00:19:06.880 --> 00:19:10.680
<v Speaker 2>Absolutely? The book shows handling incoming form data like button

407
00:19:10.680 --> 00:19:13.759
<v Speaker 2>clicks on the web page and parsing that data to

408
00:19:13.839 --> 00:19:15.599
<v Speaker 2>turn pins high GH or low W.

409
00:19:15.839 --> 00:19:17.559
<v Speaker 1>For instance, what if the web page has a lot

410
00:19:17.559 --> 00:19:19.319
<v Speaker 1>of text memory issues?

411
00:19:19.359 --> 00:19:22.519
<v Speaker 2>Again, definitely, that's where program and the f macro become

412
00:19:22.640 --> 00:19:26.240
<v Speaker 2>absolutely essential. You store all that constant HTML text and

413
00:19:26.279 --> 00:19:29.119
<v Speaker 2>flash memory, saving precious RAM. You really have to do

414
00:19:29.160 --> 00:19:31.720
<v Speaker 2>this for non trivial server pages on an UNO got it?

415
00:19:32.160 --> 00:19:34.400
<v Speaker 1>Are there other wireless options besides Wi Fi?

416
00:19:34.640 --> 00:19:37.880
<v Speaker 2>The book briefly mentions modules like the RFM sixty nine

417
00:19:38.039 --> 00:19:41.279
<v Speaker 2>HCW that use unlicensed radio frequencies good for point to

418
00:19:41.319 --> 00:19:45.119
<v Speaker 2>point or simple networks over shorter distances use libraries like Radiohead.

419
00:19:45.279 --> 00:19:48.400
<v Speaker 2>Also XB modules which are powerful but often more complex.

420
00:19:48.079 --> 00:19:51.640
<v Speaker 1>To configure, and Bluetooth Low Energy BL using.

421
00:19:51.400 --> 00:19:54.160
<v Speaker 2>The Rdueno BLE library. Let's shore r Dueno act as

422
00:19:54.160 --> 00:19:56.279
<v Speaker 2>a BL peripheral like a sense of Your phone can

423
00:19:56.279 --> 00:19:59.039
<v Speaker 2>connect to or connect to other BLE devices qew.

424
00:19:59.519 --> 00:20:04.920
<v Speaker 1>That's a lot capability. Finally, let's talk practicalities, optimization, troubleshooting.

425
00:20:05.559 --> 00:20:07.480
<v Speaker 1>The stuff in the appendices crucial stuff.

426
00:20:07.839 --> 00:20:13.160
<v Speaker 2>Understanding the build process helps preprocessor compiler AVR GCC for

427
00:20:13.240 --> 00:20:17.519
<v Speaker 2>many ar duenas, linker uploader abdude. Knowing these steps exists

428
00:20:17.720 --> 00:20:18.920
<v Speaker 2>demystifies things a.

429
00:20:18.839 --> 00:20:21.119
<v Speaker 1>Bit and memory management. We keep coming back.

430
00:20:21.000 --> 00:20:23.519
<v Speaker 2>To that because it's critical on small devices. The book

431
00:20:23.519 --> 00:20:26.480
<v Speaker 2>shows a function to check free RAM on AVR boards

432
00:20:26.880 --> 00:20:30.799
<v Speaker 2>and reiterates use progemm for constant numeric data, use f

433
00:20:31.000 --> 00:20:34.680
<v Speaker 2>text for constant text data. Saves RAM on ARM boards.

434
00:20:34.759 --> 00:20:36.559
<v Speaker 2>Constant often does the job automatically.

435
00:20:36.599 --> 00:20:38.759
<v Speaker 1>Okay, troubleshooting code won't compile.

436
00:20:39.079 --> 00:20:41.559
<v Speaker 2>Check the error messages, and remember the actual error is

437
00:20:41.640 --> 00:20:44.400
<v Speaker 2>often on the line before the highlighted one. Missing semicolons,

438
00:20:44.519 --> 00:20:48.880
<v Speaker 2>typos case sensitivity, bad comments, using keywords as variable names,

439
00:20:49.039 --> 00:20:50.960
<v Speaker 2>common mistakes. Compile often, and.

440
00:20:50.920 --> 00:20:52.400
<v Speaker 1>If it compiles but doesn't.

441
00:20:52.160 --> 00:20:54.759
<v Speaker 2>Work, serialed up, print as your best friend. Print out

442
00:20:54.839 --> 00:20:57.200
<v Speaker 2>variable values. Print messages to see where your code is

443
00:20:57.240 --> 00:20:59.599
<v Speaker 2>actually going. Build complex things incrementally.

444
00:20:59.720 --> 00:21:02.000
<v Speaker 1>Test each piece hardware troubleshooting.

445
00:21:02.160 --> 00:21:05.960
<v Speaker 2>Check connections meticulously. Use a multimeter. Wrong voltages are deadly

446
00:21:06.000 --> 00:21:10.160
<v Speaker 2>short circuits too. Test components individually. Watch polarity on things

447
00:21:10.200 --> 00:21:15.839
<v Speaker 2>like LEDs, dios, transistors, ices, resistors. Most capacitors are non polarized.

448
00:21:15.880 --> 00:21:19.759
<v Speaker 2>Breadboards help definitely for prototyping. Fritzing for diagrams, and don't

449
00:21:19.759 --> 00:21:21.599
<v Speaker 2>forget snubber.

450
00:21:21.079 --> 00:21:22.799
<v Speaker 1>Diods for motors and relays.

451
00:21:22.880 --> 00:21:26.440
<v Speaker 2>Yes, inductive loads create voltage spikes when turned off. A

452
00:21:26.480 --> 00:21:29.279
<v Speaker 2>simple diode across the load gives that spike a safe path,

453
00:21:29.559 --> 00:21:32.240
<v Speaker 2>protecting your r aduenopin super important.

454
00:21:31.920 --> 00:21:34.759
<v Speaker 1>Final practical tips, read the data sheet.

455
00:21:34.559 --> 00:21:38.319
<v Speaker 2>Always, especially for maximum ratings. Understand the code U six

456
00:21:38.319 --> 00:21:42.079
<v Speaker 2>permissions from the book. Using snippets is fine. Wholesale copying

457
00:21:42.200 --> 00:21:44.799
<v Speaker 2>isn't be careful what external power supplies.

458
00:21:45.000 --> 00:21:48.119
<v Speaker 1>Wow, Okay, that was a really comprehensive dive through these

459
00:21:48.119 --> 00:21:49.960
<v Speaker 1>are Dueno cookbook excerpts. We covered a.

460
00:21:49.920 --> 00:21:53.160
<v Speaker 2>Ton really did. From the core programming concepts structured data

461
00:21:53.240 --> 00:21:56.960
<v Speaker 2>control flow operators, right through communication protocols like serial IT,

462
00:21:57.119 --> 00:21:58.599
<v Speaker 2>two C and SPI.

463
00:21:58.440 --> 00:22:01.279
<v Speaker 1>Then getting hands on with inputs like sensors and switches

464
00:22:01.319 --> 00:22:04.599
<v Speaker 1>and outputs like LED's displays, motors.

465
00:22:04.200 --> 00:22:08.640
<v Speaker 2>Sound mastering time with Millie's and alarms, digging into hardware timers,

466
00:22:08.880 --> 00:22:10.799
<v Speaker 2>even speeding up analog reads.

467
00:22:10.559 --> 00:22:13.599
<v Speaker 1>And connecting outwards with Ethernet and Wi Fi, acting as

468
00:22:13.599 --> 00:22:18.240
<v Speaker 1>clients and servers using MQTT plus other wireless tech, and.

469
00:22:18.160 --> 00:22:22.480
<v Speaker 2>Wrapped up with vital optimization techniques especially for memory and

470
00:22:22.599 --> 00:22:25.880
<v Speaker 2>solid troubleshooting advice for both software and hardware bugs.

471
00:22:26.240 --> 00:22:29.960
<v Speaker 1>It's pretty amazing how these sources lay out practical recipes

472
00:22:30.000 --> 00:22:34.200
<v Speaker 1>for tackling quite complex tasks with these little micro controller boards.

473
00:22:34.400 --> 00:22:37.079
<v Speaker 2>Yeah, it breaks it down into manageable steps, showing you

474
00:22:37.119 --> 00:22:41.279
<v Speaker 2>the libraries, the functions, and crucially those practical gotchas like

475
00:22:41.559 --> 00:22:43.480
<v Speaker 2>timer conflicts or voltage levels.

476
00:22:43.599 --> 00:22:45.920
<v Speaker 1>So for you listening, this deep dive should give you

477
00:22:45.960 --> 00:22:48.920
<v Speaker 1>a really solid map of the practical techniques available. You've

478
00:22:48.920 --> 00:22:52.000
<v Speaker 1>seen recipes for everything from reading a button to hosting

479
00:22:52.039 --> 00:22:54.359
<v Speaker 1>a web page to driving a robot arm.

480
00:22:54.559 --> 00:22:57.079
<v Speaker 2>So here's a final thought to take away. You've now

481
00:22:57.119 --> 00:22:59.960
<v Speaker 2>seen how you can combine sensors to perceive the world,

482
00:23:00.200 --> 00:23:03.720
<v Speaker 2>actuators and displays to effect it, communication to connect it,

483
00:23:03.960 --> 00:23:07.240
<v Speaker 2>and timing to orchestrate it, all using these different ingredients

484
00:23:07.240 --> 00:23:09.559
<v Speaker 2>from the cookbook. What kind of truly interconnected may be

485
00:23:09.640 --> 00:23:13.960
<v Speaker 2>unexpected responsive project could you build? Now? What surprising interaction

486
00:23:14.079 --> 00:23:16.880
<v Speaker 2>could you create by mixing these capabilities
