= Getting to Blinky = * DEVICES: Single board computer * TOOLS: Arduino Uno, Arduino Software, USB A-B cable, Windows or Linux computer * THEORY: Arduino programming (Embedded C/C++) * HANDS-ON: Write an Arduino program and get it running! Arduino is a popular ultra-low-cost computing platform that is easy to program and build into robots and other devices. You should have received a kit that includes an Arduino Uno single board computer and USB cable. The objectives of this lesson are to learn about the Arduino Uno, install the Arduino software on your computer, connect your computer to the Arduino Uno, and load an example program onto it. We will also explore the Arduino Uno itself and the structure of an Arduino program. Let's get started. The Arduino software includes everything you need to write programs for your Arduino Uno. Arduino software is available for Windows, Linux, and Mac OS. Many of the school computers already have Arduino software installed. If your computer does not have the software installed, download it now from [https://www.arduino.cc/en/Main/Software here] and install it on your computer. Please follow the detailed instructions on how to install the software and get started [https://www.arduino.cc/en/Guide/HomePage here]. == Arduino Uno == [[Image(https://upload.wikimedia.org/wikipedia/commons/3/38/Arduino_Uno_-_R3.jpg,250px)]] The Arduino Uno is a single-board computer based on the AVR ATMega32 microcontroller; you can read more about it [https://www.arduino.cc/en/Main/arduinoBoardUno here]. We use the Arduino Uno because it is easy and low cost (often available for [https://www.aliexpress.com/item/32981776049.html under $3.50] or less than $10 via [https://www.amazon.com/HiLetgo-ATmega328P-Development-Compatible-Microcontroller/dp/B01AR7YJ3O/ amazon prime]). A microcontroller is a single integrated circuit that contains a microprocessor, memory, flash storage, and a host of peripherals to connect to other devices such as USB ports, serial ports, digital and analog input and output ports, etc. The Uno provides a standard interface (two rows of black connectors) that allow you to interface with many other devices. There are a wide range of off-the-shelf devices available that can plug into those black connectors; many are the same shape as the Uno and are referred to as "shields". You can purchase Ethernet shields, !WiFi shields, Motor controller shields, etc. Shields have the same set of black connectors and are stackable. You can (and should) read about arduino shields [https://learn.sparkfun.com/tutorials/arduino-shields here]. Your kit includes a prototyping shield and in later lessons you will use a motor control shield to drive the motors in a mini-bot. == Arduino Software == If you followed the instructions above, you have already seen and run an Arduino program: blinky (if you haven't, please do so now). Arduino developers refer to programs as "sketches". Sketches are written in C and C++ which are the most popular languages for programming embedded computers (computers without screens and keyboards). Java is derived from C/C++ and is extremely similar; if you know Java, you will have no problem with C/C++. A good introduction to Arduino programming and the blinky example program is [http://www.ladyada.net/learn/arduino/lesson2.html here] (please follow the link and read the introduction). == Activities == You should now be familiar with the basic structure of an Arduino sketch including the setup() and loop() functions and you should be able to compile a sketch and load it onto your Arduino Uno. Try the following: * vary the speed and duty cycle of the blinking LED by changing the delays * make the LED fade in and out rather than blink on and off by varying a fast duty cycle == Other Stuff == * You can even develop in the cloud (see [https://codebender.cc/ here]). * You can connect to your Arduino using [http://www.instructables.com/id/Cheap-2-Way-Bluetooth-Connection-Between-Arduino-a/ Bluetooth] * There are *many* other tutorials including: * [http://www.ladyada.net/learn/arduino/ Adafruit] * [https://learn.sparkfun.com/tutorials/what-is-an-arduino Sparkfun] (Sparkfun has [https://learn.sparkfun.com/tutorials/tags/arduino many excellent arduino tutorials]) * MIT has numerous Arduino project and tutorial videos [https://www.youtube.com/results?search_query=MIT+Arduino MIT]. * Advanced users should pay special attention to [https://www.youtube.com/watch?v=30rPt802n1k this one] which discusses using a small, inexpensive, bread-boardable ATTiny chip for your custom projects instead of using a whole Arduino board. * Another Arduino-specific wiki is [http://arduino-info.wikispaces.com/ here]