Changes

Jump to navigation Jump to search

Workshop: Introduction to Microcontrollers with Arduino

421 bytes added, 13:49, 20 February 2019
begin major fixes
You’re also going to be using a different microcontroller for this lab. Instead of the Xplained, you’ll be using a device called the Teensy 3.2. As its name suggests, it’s pretty small! As such, the silkscreen (the text that appears on the faces of the printed circuit board, usually indicating things like pin labels) is minimal. In order to actually utilize the Teensy, you’ll need its pinout.
Because your new board is a custom product not designed by Atmel, the Arduino IDE doesn’t support your board right out of the box. However, the IDE does allow extra board definitions to be added. So that’s what you’re going to do now: install the IDE, and then install a small tool that adds extra board defs so that you board will work with the software. (Note from here on out that in this lab, any keyboard shortcuts referenced will be the Windows version. For MacOS, just substitute CTRL for CMD and ALT for CTRL, respectively.)
== This certification is for the use of the micro-controller set. ==
'''This workshop will consist of two main objectives; how to control Digital output and inputs and how to control an analog output and input'''
(basic outline)
== Software setup ==
 
You're going to need two pieces of software to work with the microcontroller.
 
=== Download and install ===
# Download and install the [https://www.arduino.cc/en/main/software Arduino IDE] on your operating system of choice. ''(Note: if you're using Windows, use the installer, not the app!)''
 
# Download and install [https://www.pjrc.com/teensy/td_download.html Teensyduino], which adds Teensy support to the Arduino IDE. Just follow the prompts; you don’t need to install all the libraries, but if you ever want to work with Teensies in the future, it’s worth taking the time to install them now.
=== The which, the where, and the how ===
In order to get the Arduino IDE up and running with your board - regardless of which board it happens to be - you must answer for it three questions: the which, the where, and the how.
Double check that # Which board are you are using the right board by going ?\#* Navigate to ''Tools then Board '' and selecting select ''Teensy 3.2 / 3.1, then go ''# Where is the board connected?#* Navigate to ''Tools → Port '' and depending on your operating system go to :#** Windows: select ''COMX'', where ''X '' is the largest number (it should also say Teensy 3.2) or #** OSX: select ''/dev/cu.usbmodemXXXXXX'', where ''XXXXXX '' is some number. This may not show up with Teensy.#** (You can see that neither of these operating systems handle hardware communication ports very elegantly.) # How are you programming the board? So far, you’ve used the mEDBG device for programming. Teensy won’t work with that - but it will work with the default programmer for teensy is , the AVRISP mkII. To use it go #* Navigate to ''Tools → Programmer '' and select ''AVRISP mkII''== Digital output ==  1. create a new file  [[File:code for teensy.png]]  2. then upload the code to your board using the button or CTRL+U. This is actually a compile and program. If you get any errors, ask for help. Assuming it has programmed correctly, you should now see the onboard LED blinking!
3.Fiddle with the delay times and reprogram to see how you can affect the speed of the LED blinking.
4.Connect an LED and a 330Ω resistor == Activity 01: Digital output (just like in previous labsaka 'Hello World' for hardware) ==This activity sees you using a pin on the microcontroller to D9, and then change to code to reference this new LED’s pinblink an LED.
5# Navigate to ''File → Examples → 01.Basics → Blink''.<br>The code which appears should look something like this:<br>[[File:code for teensy.png]]# Upload the code to your board using the button or CTRL+U. This is actually a compile and program. If you get any errors, ask for help. Assuming it has programmed correctly, you should now see the onboard LED blinking!# Fiddle with the delay times and reprogram to see how you can affect the speed of the LED blinking.# Connect an LED and a 220Ω resistor (just like in previous labs) to D9, and then change to code to reference this new LED’s pin.# Compile and Program to test.
'''NOTE: There is a button on the Teensy. This button does not do what you think it does. This button is a program button, meaning that when you press it, the device takes the most-recently compiled code and sticks it in its program memory. This is not a reset button!'''
== Activity 02: Digital Input(aka a button) ==
1.Navigate to File → Examples → 02.Digital → Button.

Navigation menu