1
00:00:00,690 --> 00:00:07,500
In this lecture, I'll show you how to use an analog accelerometer like the ATX or three three five

2
00:00:07,590 --> 00:00:08,580
breakout device.

3
00:00:09,060 --> 00:00:17,370
So in this example, I have connected the accelerometer to three Gio's that are capable of analog to

4
00:00:17,370 --> 00:00:21,570
digital conversion, just removing it so you can see the warming underneath.

5
00:00:22,080 --> 00:00:25,530
So I've got the X, Y, Z pinch of the accelerometer.

6
00:00:25,710 --> 00:00:32,850
And via this chunk of wires, these are connected to tapirs 30 to 35 and 34.

7
00:00:33,150 --> 00:00:47,190
So Z is 32, Y is thirty five and X is thirty four and foreground close to the ground rail and addition

8
00:00:47,190 --> 00:00:52,290
to the three point three volt rail like that back into the breadboard.

9
00:00:54,380 --> 00:01:01,290
And having a look at the sketch, if you have watched the lecture on the potential mirror, then you

10
00:01:01,290 --> 00:01:04,620
already know how to use the ATC function.

11
00:01:04,770 --> 00:01:06,480
Part of the machine module.

12
00:01:06,930 --> 00:01:12,540
Well you've got to do is to import it and then you create the three analog to digital conversion objects

13
00:01:12,540 --> 00:01:14,640
that we need for the X and Y.

14
00:01:15,030 --> 00:01:23,100
Just pass the pin to which you have connected each one of the accelerometer pins, then offset the attenuation

15
00:01:23,100 --> 00:01:24,750
for each one of those.

16
00:01:24,870 --> 00:01:30,750
And look, the digital converter objects found that 11 decibels attenuation is the best that fits here.

17
00:01:31,590 --> 00:01:38,670
The purpose, since we are using three point three volt input for the accelerometer power input, is

18
00:01:39,060 --> 00:01:42,430
that also defines the range of the output.

19
00:01:42,450 --> 00:01:44,820
So 11 destabilises what we need here.

20
00:01:45,780 --> 00:01:46,860
And I've got a timer.

21
00:01:47,220 --> 00:01:56,130
The timer expires every 15 milliseconds and calls the eight zero three three five since I saw function

22
00:01:56,130 --> 00:02:01,730
right here, which simply takes the three readings and then puts them out to the shell.

23
00:02:02,220 --> 00:02:06,240
And because I have to get three clear numbers, print that in the shell.

24
00:02:06,600 --> 00:02:11,430
The Explorer also works and it gives me the three values.

25
00:02:11,610 --> 00:02:15,970
They should be represented in these acts in this two x y axis.

26
00:02:16,680 --> 00:02:23,010
So if I move my breadboard with the accelerometer on it, you can see that the values vary.

27
00:02:23,460 --> 00:02:33,510
In this case, the X and Y values very little bit more than busy site and a board upside down breadboard.

28
00:02:34,020 --> 00:02:34,860
You can see that.

29
00:02:34,860 --> 00:02:36,090
The orange.

30
00:02:37,200 --> 00:02:38,130
So the green.

31
00:02:39,590 --> 00:02:42,710
Line and value also changes.

32
00:02:44,640 --> 00:02:54,210
Move over to the y axis with y axis front and back, you can see the headline moves so.

33
00:02:55,350 --> 00:03:03,830
This is just a simple case of using the ADC typewriters to receive three analog values from an analog

34
00:03:03,830 --> 00:03:04,750
accelerometer.

35
00:03:04,790 --> 00:03:12,950
And this way now it's better to gadget knows which way it's it's facing or which way it's oriented based

36
00:03:12,950 --> 00:03:14,690
on the readings of three.

37
00:03:14,780 --> 00:03:15,380
Excellent.
