Saturday, September 30, 2017

21 September '17- Day 8- Intro to Data Structures, voltage regulators, servos

For todays lab we were introduced to voltage regulators and servos.  a voltage regulator works that it will supply a rated voltage given an input voltage is above that certain value.  In the case for our lab, we were given a 5 volt linear regulator to supply the servo we are using.  The servos them selves can run off the 5 volts from the arduino board but the 9v can provide the necessary current to run properly.  Once the servo is wired up the code for the arduino is fairly simple since there is a function already written in the arduino library to control the servo.  Part of the homework was to get the servo running and also attaching an arrow that points at the direction of movement sensed by the PIR sensor.
(here is a servo being used for project 1)

During lecture we talked about one dimensional arrays.  With arrays, we can declare a lot of the same data points without having to repeatedly declare variables for each point.  This technique cuts down on time and can store large amounts of data but can also make it difficult to debug a program.  In order to get a specific value that is declared in an array you must specify that element with a subscript, keeping in mind that the baseline for the order count starts at 0.  It is good practice to write a "define" at the beginning of the program to declare the number of elements in an array.

(examples in class of arrays)
For homework we were given our first project to come up with and include everything we've learned up to this point in the class.  My lab partner, Christina, and I decided on making a pet box and including some of the sensors to interact with the user.  More to come for Project 1...
(brain storming ideas for project 1)

No comments:

Post a Comment