Saturday, September 30, 2017

14 September '17- Day 6- Functions and Modularity

Class began with Professor Mason checking our homework for integrating the TMP sensor with LEDs to indicate the ambient temperature and turning on a corresponding colored LED.  The next lab included a PIR sensor and wiring into our bread board to turn on LEDs when the sensor triggered by movement.  In class we went over programmer defined functions when trying to find the first 20 values of sin pi(x)/ pi(x).  From there we began talking about storage class and scope of variables.  Global variable and local variables define where they can be accessed to in a program.  local variables are defined within a function and can only be accessed within that function.  Global variables are defined outside the main function and can be accessed any time throughout the program by any function.  The last part of class we were given a problem to find the greater circle distance around the globe by being given two coordinate points.  Writing the program, we had to have user input two coordinates and generate the shortest distance from the two points.
(including a PIR sensor to light up LED)

(using coordinates to find angles between two vectors)

(having a TMP sensor indicated by LEDs; if temperature is hot the red led turns on, if temp is cold green led is on)


(screen shot for the greater distance program in class)

No comments:

Post a Comment