Topics
- Class Notes
- Servo Lab
- Array Homework
Lecture Notes
We presented out project which worked except for the errors we forced onto ourselves when we were going over the project with Professor Mason. We have to remember to shut up when we are ahead and not invite loses. Next time I will have to spend a little more time really getting the code to run well and remove the things that didn't work from the final project.
Working with arrays, the concept isn't overly difficult just plenty of nuance I'll have to mess with. The next step is to integrate the ability to access files from my computer to populate the array. This entire topic smells like rocket payload to me, data aquisition and manipulation.
Servo Lab
We started off the class with our first step into working with servos. Robert and I quickly got ours working.
I used the original code to find the values I need to pass my servo in order for it to move the right amount. It turns out the original code had mapped val to be a one to one translation into angles of
movement from about 0 to 180 degrees.
It was easy enough to set up a digital read with my IR sensor and use that to trigger the servo. Than all I had to do was to write a simple if statement and pass my servo the correct values I needed.
Array Homework
The first problem was a matter of printing out the values after compiling a program. I run one code, commend out the appropriate parts, recompile, and run the code a second time. The first value is 14 and the second value is 6.
Then I moved onto the random number function. I tried to get the function to work as is but I kept running into the problem of data types. The rand() is an integer and, for some reason, the compiler didn't like that I used doubles in my interval start and interval end. It wasn't until I changed those to integers did the function actually work. I am sure this is a compiler problem because the book says that this will usually result in the lower data type being automatically converted to higher data type and then working.
The same thing happened with my array. I initially defined it to be a double with didn't store values because i was feeding it integers. When I redefined the array then it worked.
Mean and Variance Programming
The first step was to write a function that returns a random value.
I then wrote a program that would populate an array with the elements of my random numbers.
I then found the mean of my array
next I wrote a bit of code to find the valence in my sample.
My theoretical mean is 7 and my theoretical variance is 3. When I ran my program with a 14 data points, these are my results





No comments:
Post a Comment