In this lecture, I'll show you how to use an analog accelerometer like the ATX or three three five
breakout device.
So in this example, I have connected the accelerometer to three Gio's that are capable of analog to
digital conversion, just removing it so you can see the warming underneath.
So I've got the X, Y, Z pinch of the accelerometer.
And via this chunk of wires, these are connected to tapirs 30 to 35 and 34.
So Z is 32, Y is thirty five and X is thirty four and foreground close to the ground rail and addition
to the three point three volt rail like that back into the breadboard.
And having a look at the sketch, if you have watched the lecture on the potential mirror, then you
already know how to use the ATC function.
Part of the machine module.
Well you've got to do is to import it and then you create the three analog to digital conversion objects
that we need for the X and Y.
Just pass the pin to which you have connected each one of the accelerometer pins, then offset the attenuation
for each one of those.
And look, the digital converter objects found that 11 decibels attenuation is the best that fits here.
The purpose, since we are using three point three volt input for the accelerometer power input, is
that also defines the range of the output.
So 11 destabilises what we need here.
And I've got a timer.
The timer expires every 15 milliseconds and calls the eight zero three three five since I saw function
right here, which simply takes the three readings and then puts them out to the shell.
And because I have to get three clear numbers, print that in the shell.
The Explorer also works and it gives me the three values.
They should be represented in these acts in this two x y axis.
So if I move my breadboard with the accelerometer on it, you can see that the values vary.
In this case, the X and Y values very little bit more than busy site and a board upside down breadboard.
You can see that.
The orange.
So the green.
Line and value also changes.
Move over to the y axis with y axis front and back, you can see the headline moves so.
This is just a simple case of using the ADC typewriters to receive three analog values from an analog
accelerometer.
And this way now it's better to gadget knows which way it's it's facing or which way it's oriented based
on the readings of three.
Excellent.