Saturday, January 27, 2018

Lab 7: Introduction To Microcontrollers

In this lab we learned how to use a microcontroller and what they are designed to do.  The microcontroller that we are using is the Arduino Uno which is a small microcontroller that has both analog and digital inputs, ground, voltage and is programmable.  The code that is programmed into the Arduino turns the pins on or off (High or Low) which then controls whatever is connected to the Arduino.



First we opened the Arduino software and plugged in the Arduino.  After checking the settings, we uploaded a pre-made code for blinking.  We noticed the orange light was blinking after uploading the code and the rate at which the blinking occurred changed as we changed the delay on the code.



Then we build a simple circuit with an LED, 220 ohm resistor and connected the positive end of the LED to pin 10 in the Arduino. After writing a simple code to have the LED turn on and off with a 1 second delay and uploading the code, the LED flashed as expected.



You can see we only had four lines of code in the loop which turned the LED on and off, and a one second delay in between each.


We then used the same technique to connect 4 LED's to the Arduino and control them.  The process was almost identical as the single LED, we just had to write code for each LED changing only the pin numbers based on which pin they were connected to.  We also had to define the pins.  Once the code was uploaded to the Arduino and we adjusted the delay, we had the lights flashing in a pattern similar to the KITT car on Knight Rider.



The delay was adjusted to 25ms which made the cycle much faster and gave the illusion of motion from the pattern of flashing lights.


Lab 7 finished!

No comments:

Post a Comment

Lab 17: Using IR Sensors for flame and line detection for the VEX

In this lab, we used everything we learned in the previous labs to complete this final lab challenge.  The challenge was to navigate a maze ...