Sending Data from a Computer to a Microcontroller Using a UART (Universal Asynchronous Receiver/Transmitter)

Total Page:16

File Type:pdf, Size:1020Kb

Sending Data from a Computer to a Microcontroller Using a UART (Universal Asynchronous Receiver/Transmitter) Sending Data from a computer to a microcontroller using a UART (Universal Asynchronous Receiver/Transmitter) Eric Bell 04/05/2013 Abstract: Serial communication is the main method used for communication between external microcontrollers and computers, and can be a challenge to set up correctly. This application note will provide a walk-through example on how to set up a simple UART communication link using Microsoft Visual Studio and the Arduino Leonardo microcontroller. Keywords: Arduino, Leonardo, Visual Studio, Microcontroller, UART Page | 1 Table of Contents Introduction...................................................................................................................................3 Arduino Software Installation........................................................................................................4 Hardware Setup.............................................................................................................................4 Setting up the Receiver…………………………………………………………………………………………………………….5 Setting up the Sender……………………………………………………………………………………………………………….6 Recommendations…………………………………………………………………………………………………………………….9 References………………………………………………………………………………………………………………………………..9 Page | 2 Introduction: This application note will provide instructions on how to obtain simple communications between a computer and a microcontroller using UART (Universal Asynchronous Receiver/Transmitter). UART is a commonly used piece of hardware which translates data between parallel and serial communication mediums (See reference [6]). In this tutorial, you will be taught how to set up a simple interface between a computer and a microcontroller by utilizing Microsoft Visual Studio, and the Arduino Leonardo microcontroller. The implementation described in this application note will provide a walk-through to set up the Arduino Leonardo to receive communication from the computer and then respond appropriately. In this case, the microcontroller will receive characters from the computer consisting of either ‘+’ or ‘-‘. These characters will activate an LED by turning it on or off, by interpreting a ‘+’ as an “on” signal, and a ‘-‘ as an “off” signal. Implementation: Hardware: - Personal Computer running Microsoft Windows - Arduino Leonardo Microcontroller - Micro-USB Interconnect Cable - 1 LED (any color) - 1 220-Ohm resistor Software: - Microsoft Visual Studio - Arduino IDE Software - Arduino Leonardo Drivers Page | 3 Arduino Software Installation Download and install the Arduino IDE Software and Arduino Leonardo Drivers by following the set-up instructions provided with the software. Arduino IDE Software and Leonardo Drivers can be obtained free of charge by download by visiting http://arduino.cc/en/Main/Software. Hardware Setup For this communications set-up, we will be physically connecting the Arduino Leonardo microcontroller to the computer using a micro-USB interconnect cable, and setting up the microcontroller to provide feedback through the lighting of an LED. The microcontroller can be obtained by ordering, and is available at many different web sites on the internet. One major distributor of Arduino products is Mouser, and this microcontroller can be ordered from them by visiting www.mouser.com/Arduino-Leonardo. Follow the steps outlined below for proper set-up: 1) Connect the 220-ohm resistor and LED to the Arduino Leonardo microcontroller by following the diagram below. (See Reference [1]) 2) Plug the Micro-USB cable in to the Arduino Leonardo in to the attached port, and in to any available USB port on the computer. Page | 4 Setting up the Receiver The Arduino Leonardo microcontroller needs to be set up to receive a character from the USB port, and also needs to be programmed to respond appropriately based upon the received character. This will be accomplished by using the Arduino IDE Software and the following code (See reference [1]): int led = 13; char c; void setup() { pinMode(led, OUTPUT); // specify led port as output Serial.begin(9600); // Specify serial communications speed } void loop() { if(Serial.available() > 0) { c = Serial.read(); // reads a character from serial interface Serial.print(c); if(c == '+') { digitalWrite(led, HIGH); // turn on LED } else if(c == '-') { digitalWrite(led, LOW); // turn off LED } } } The code above is written in C#, and will specify port 13 as the port for our LED, and will determine whether the Arduino Leonardo will turn on or turn off the LED. Once this code has been typed in to the Arduino IDE software, it can be uploaded by clicking on File-> Save, and then clicking on the Upload button. The button is depicted as a small arrow in the upper left corner of the program screen. Page | 5 Setting up the Sender For this portion of the set-up, we will be using Microsoft Visual Studio to create a program which will send the ‘+’ or ‘-‘ character to the Arduino Leonardo microcontroller through the USB cable. This portion of the application note will provide a demonstration on how to write code that will: 1) Determine if there is a serial port currently available for communication 2) Open the serial port for communications 3) Send data through the serial port 4) Close the serial port Microsoft Visual Studio should be used to create a new project, in which you should create one combo-box, and four buttons. This can be accomplished within the program by clicking on The toolbox icon on the left side of the screen, and then double-clicking on the Button link. This will allow you to place the button on your blank form. Once all buttons have been placed, double- click on the ComboBox link in order to place the drop-down menu as shown in the figure. Complete instructions are included in the Microsoft documentation on their web site (Reference [4]). When complete, your program GUI (Graphics User Interface) should look similar to this: The code on the following pages will then be used to control the functions of the combo-box and buttons. Page | 6 Example code to determine if there is a serial port currently available (See reference [2]): private void Form1_Load(object sender, EventArgs e) { foreach (string port in SerialPort.GetPortNames()) // Adds all port names to ports list { cbPorts.Items.Add(port); // adds ports to Ports combo-box } if (cbPorts.Items.Count > 0) // if there is at least one port available, select the first one as default { cbPorts.SelectedIndex = 0; } else // no ports available { cbPorts.Enabled = false; MessageBox.Show("Could not locate any available serial ports.", "No serial ports", MessageBoxButtons } btnSendA.Enabled = false; btnSendB.Enabled = false; btnClose.Enabled = false; } Page | 7 Example code to open the serial port for communication (See reference [3]): private void btnOpen_Click(object sender, EventArgs e) { _serialPort = new SerialPort(cbPorts.Text); // Store serial ports in combo-box _serialPort.BaudRate = 9600; // Set Port speed _serialPort.DataBits = 8; // Use 8 bits for data _serialPort.Parity = Parity.None; // No Parity _serialPort.StopBits = StopBits.One; _serialPort.Open(); // Open the port _serialPort.WriteTimeout = 5000; // set time-out time for write // Change the Enabled flag for the buttons to prevent user error cbPorts.Enabled = false; btnOpen.Enabled = false; btnSendPlus.Enabled = true; btnSendMinus.Enabled = true; btnClose.Enabled = true; } Example code to write a ‘+’ to the open serial port (See reference [3]): private void button1_Click(object sender, EventArgs e) { _serialPort.WriteLine("+"); // Writes a '+' to the open Serial Port } Example code to close the serial port (See reference [3]): private void btnClose_Click(object sender, EventArgs e) { _serialPort.Close(); // Change the Enabled flag for the buttons to prevent user error cbPorts.Enabled = true; btnOpen.Enabled = true; btnSendPlus.Enabled = false; btnSendMinus.Enabled = false; btnClose.Enabled = false; } Page | 8 In this application note, we have covered the set up of the hardware, the design and programming of the user interface, as well as the programming of the Arduino Leonardo firmware. By following these instructions, it should be a very straight-forward task to develop communication between the computer and the Arduino Leonardo microcontroller. Once these techniques have been practiced, they can be applied to more complex situations, as well as to other microcontrollers. Recommendations - The Arduino Leonardo can also be used to send date to the computer using the serial interface. There are many examples and tutorials available for free by utilizing the Arduino web site. (See reference [1]) - The serial ports on the Arduino Leonardo can be used to communicate to more complex devices, such as other microcontrollers - More complex Arduino Microcontrollers are capable of communication through a much wider array of communication mediums, such as WiFi, rather than just serial communication References [1] http://arduino.cc/en/Tutorial/HomePage [2] http://msdn.microsoft.com/en-us/library/tf8zk72w.aspx [3] http://msdn.microsoft.com/en-us/library/y2sxhat8.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2 [4] http://msdn.microsoft.com/en-us/vstudio/aa718325.aspx [5] http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter Page | 9 .
Recommended publications
  • Arithmetic and Logic Unit (ALU)
    Computer Arithmetic: Arithmetic and Logic Unit (ALU) Arithmetic & Logic Unit (ALU) • Part of the computer that actually performs arithmetic and logical operations on data • All of the other elements of the computer system are there mainly to bring data into the ALU for it to process and then to take the results back out • Based on the use of simple digital logic devices that can store binary digits and perform simple Boolean logic operations ALU Inputs and Outputs Integer Representations • In the binary number system arbitrary numbers can be represented with: – The digits zero and one – The minus sign (for negative numbers) – The period, or radix point (for numbers with a fractional component) – For purposes of computer storage and processing we do not have the benefit of special symbols for the minus sign and radix point – Only binary digits (0,1) may be used to represent numbers Integer Representations • There are 4 commonly known (1 not common) integer representations. • All have been used at various times for various reasons. 1. Unsigned 2. Sign Magnitude 3. One’s Complement 4. Two’s Complement 5. Biased (not commonly known) 1. Unsigned • The standard binary encoding already given. • Only positive value. • Range: 0 to ((2 to the power of N bits) – 1) • Example: 4 bits; (2ˆ4)-1 = 16-1 = values 0 to 15 Semester II 2014/2015 8 1. Unsigned (Cont’d.) Semester II 2014/2015 9 2. Sign-Magnitude • All of these alternatives involve treating the There are several alternative most significant (leftmost) bit in the word as conventions used to
    [Show full text]
  • FUNDAMENTALS of COMPUTING (2019-20) COURSE CODE: 5023 502800CH (Grade 7 for ½ High School Credit) 502900CH (Grade 8 for ½ High School Credit)
    EXPLORING COMPUTER SCIENCE NEW NAME: FUNDAMENTALS OF COMPUTING (2019-20) COURSE CODE: 5023 502800CH (grade 7 for ½ high school credit) 502900CH (grade 8 for ½ high school credit) COURSE DESCRIPTION: Fundamentals of Computing is designed to introduce students to the field of computer science through an exploration of engaging and accessible topics. Through creativity and innovation, students will use critical thinking and problem solving skills to implement projects that are relevant to students’ lives. They will create a variety of computing artifacts while collaborating in teams. Students will gain a fundamental understanding of the history and operation of computers, programming, and web design. Students will also be introduced to computing careers and will examine societal and ethical issues of computing. OBJECTIVE: Given the necessary equipment, software, supplies, and facilities, the student will be able to successfully complete the following core standards for courses that grant one unit of credit. RECOMMENDED GRADE LEVELS: 9-12 (Preference 9-10) COURSE CREDIT: 1 unit (120 hours) COMPUTER REQUIREMENTS: One computer per student with Internet access RESOURCES: See attached Resource List A. SAFETY Effective professionals know the academic subject matter, including safety as required for proficiency within their area. They will use this knowledge as needed in their role. The following accountability criteria are considered essential for students in any program of study. 1. Review school safety policies and procedures. 2. Review classroom safety rules and procedures. 3. Review safety procedures for using equipment in the classroom. 4. Identify major causes of work-related accidents in office environments. 5. Demonstrate safety skills in an office/work environment.
    [Show full text]
  • The Central Processing Unit(CPU). the Brain of Any Computer System Is the CPU
    Computer Fundamentals 1'stage Lec. (8 ) College of Computer Technology Dept.Information Networks The central processing unit(CPU). The brain of any computer system is the CPU. It controls the functioning of the other units and process the data. The CPU is sometimes called the processor, or in the personal computer field called “microprocessor”. It is a single integrated circuit that contains all the electronics needed to execute a program. The processor calculates (add, multiplies and so on), performs logical operations (compares numbers and make decisions), and controls the transfer of data among devices. The processor acts as the controller of all actions or services provided by the system. Processor actions are synchronized to its clock input. A clock signal consists of clock cycles. The time to complete a clock cycle is called the clock period. Normally, we use the clock frequency, which is the inverse of the clock period, to specify the clock. The clock frequency is measured in Hertz, which represents one cycle/second. Hertz is abbreviated as Hz. Usually, we use mega Hertz (MHz) and giga Hertz (GHz) as in 1.8 GHz Pentium. The processor can be thought of as executing the following cycle forever: 1. Fetch an instruction from the memory, 2. Decode the instruction (i.e., determine the instruction type), 3. Execute the instruction (i.e., perform the action specified by the instruction). Execution of an instruction involves fetching any required operands, performing the specified operation, and writing the results back. This process is often referred to as the fetch- execute cycle, or simply the execution cycle.
    [Show full text]
  • Computer Monitor and Television Recycling
    Computer Monitor and Television Recycling What is the problem? Televisions and computer monitors can no longer be discarded in the normal household containers or commercial dumpsters, effective April 10, 2001. Televisions and computer monitors may contain picture tubes called cathode ray tubes (CRT’s). CRT’s can contain lead, cadmium and/or mercury. When disposed of in a landfill, these metals contaminate soil and groundwater. Some larger television sets may contain as much as 15 pounds of lead. A typical 15‐inch CRT computer monitor contains 1.5 pounds of lead. The State Department of Toxic Substances Control has determined that televisions and computer monitors can no longer be disposed with typical household trash, or recycled with typical household recyclables. They are considered universal waste that needs to be disposed of through alternate ways. CRTs should be stored in a safe manner that prevents the CRT from being broken and the subsequent release of hazardous waste into the environment. Locations that will accept televisions, computers, and other electronic waste (e‐waste): If the product still works, trying to find someone that can still use it (donating) is the best option before properly disposing of an electronic product. Non‐profit organizations, foster homes, schools, and places like St. Vincent de Paul may be possible examples of places that will accept usable products. Or view the E‐waste Recycling List at http://www.mercedrecycles.com/pdf's/EwasteRecycling.pdf Where can businesses take computer monitors, televisions, and other electronics? Businesses located within Merced County must register as a Conditionally Exempt Small Quantity Generator (CESQG) prior to the delivery of monitors and televisions to the Highway 59 Landfill.
    [Show full text]
  • Console Games in the Age of Convergence
    Console Games in the Age of Convergence Mark Finn Swinburne University of Technology John Street, Melbourne, Victoria, 3122 Australia +61 3 9214 5254 mfi [email protected] Abstract In this paper, I discuss the development of the games console as a converged form, focusing on the industrial and technical dimensions of convergence. Starting with the decline of hybrid devices like the Commodore 64, the paper traces the way in which notions of convergence and divergence have infl uenced the console gaming market. Special attention is given to the convergence strategies employed by key players such as Sega, Nintendo, Sony and Microsoft, and the success or failure of these strategies is evaluated. Keywords Convergence, Games histories, Nintendo, Sega, Sony, Microsoft INTRODUCTION Although largely ignored by the academic community for most of their existence, recent years have seen video games attain at least some degree of legitimacy as an object of scholarly inquiry. Much of this work has focused on what could be called the textual dimension of the game form, with works such as Finn [17], Ryan [42], and Juul [23] investigating aspects such as narrative and character construction in game texts. Another large body of work focuses on the cultural dimension of games, with issues such as gender representation and the always-controversial theme of violence being of central importance here. Examples of this approach include Jenkins [22], Cassell and Jenkins [10] and Schleiner [43]. 45 Proceedings of Computer Games and Digital Cultures Conference, ed. Frans Mäyrä. Tampere: Tampere University Press, 2002. Copyright: authors and Tampere University Press. Little attention, however, has been given to the industrial dimension of the games phenomenon.
    [Show full text]
  • Intel® Galileo Software Package Version: 1.0.2 for Arduino IDE V1.5.3 Release Notes
    Intel® Galileo Software Package Version: 1.0.2 for Arduino IDE v1.5.3 Release Notes 23 June 2014 Order Number: 328686-006US Intel® Galileo Software Release Notes 1 Introduction This document describes extensions and deviations from the functionality described in the Intel® Galileo Board Getting Started Guide, available at: www.intel.com/support/go/galileo This software release supports the following hardware and software: • Intel® Galileo Customer Reference Board (CRB), Fab D with blue PCB • Intel® Galileo (Gen 2) Customer Reference Board (CRB), Gen 2 marking • Intel® Galileo software v1.0.2 for Arduino Integrated Development Environment (IDE) v1.5.3 Note: This release uses a special version of the Arduino IDE. The first thing you must do is download it from the Intel website below and update the SPI flash on the board. Features in this release are described in Section 1.4. Release 1.0.2 adds support for the 2nd generation Intel® Galileo board, also called Intel® Galileo Gen 2. In this document, for convenience: • Software and software package are used as generic terms for the IDE software that runs on both Intel® Galileo and Galileo (Gen 2) boards. • Board is used as a generic term when either Intel® Galileo or Galileo (Gen 2) boards can be used. If the instructions are board-specific, the exact model is identified. 1.1 Downloading the software release Download the latest Arduino IDE and firmware files here: https://communities.intel.com/community/makers/drivers This release contains multiple zip files, including: • Operating system-specific IDE packages, contain automatic SPI flash update: − Intel_Galileo_Arduino_SW_1.5.3_on_Linux32bit_v1.0.2.tgz (73.9 MB) − Intel_Galileo_Arduino_SW_1.5.3_on_Linux64bit_v1.0.2.tgz (75.2 MB) − Intel_Galileo_Arduino_SW_1.5.3_on_MacOSX_v1.0.2.zip (56.0 MB) − Intel_Galileo_Arduino_SW_1.5.3_on_Windows_v1.0.2.zip (106.9 MB) • (Mandatory for WiFi) Files for booting board from SD card.
    [Show full text]
  • What Is a Microprocessor?
    Behavior Research Methods & Instrumentation 1978, Vol. 10 (2),238-240 SESSION VII MICROPROCESSORS IN PSYCHOLOGY: A SYMPOSIUM MISRA PAVEL, New York University, Presider What is a microprocessor? MISRA PAVEL New York University, New York, New York 10003 A general introduction to microcomputer terminology and concepts is provided. The purpose of this introduction is to provide an overview of this session and to introduce the termi­ MICROPROCESSOR SYSTEM nology and some of the concepts that will be discussed in greater detail by the rest of the session papers. PERIPNERILS EIPERI MENT II A block diagram of a typical small computer system USS PRINIER KErBOARD INIERfICE is shown in Figure 1. Four distinct blocks can be STDRIGE distinguished: (1) the central processing unit (CPU); (2) external memory; (3) peripherals-mass storage, CONTROL standard input/output, and man-machine interface; 0111 BUS (4) special purpose (experimental) interface. IODiISS The different functional units in the system shown here are connected, more or less in parallel, by a number CENTKll ElIEBUL of lines commonly referred to as a bus. The bus mediates PROCESSING ME MOil transfer of information among the units by carrying UN IT address information, data, and control signals. For example, when the CPU transfers data to memory, it activates appropriate control lines, asserts the desired Figure 1. Block diagram of a smaIl computer system. destination memory address, and then outputs data on the bus. Traditionally, the entire system was built from a CU multitude of relatively simple components mounted on interconnected printed circuit cards. With the advances of integrated circuit technology, large amounts of circuitry were squeezed into a single chip.
    [Show full text]
  • Class of 2023 Required Laptop Computer Specifications
    Class of 2023 Required Laptop Computer Specifications Computer Component Mandatory Minimum Additional Information Computer’s Operating System Windows 10 Professional Edition Windows OS required by IMSA OS Computer Science Department Apple/Macintosh OS Not Recommended Linux OS Not Recommended Computer’s processing power Intel or AMD i5, 8th Generation i7 – 8th Generation Chip Processor Chip recommended for students interested in graphic design, animation, CAD/CAM, high processing demand applications Computer’s Memory 8GB 16GB recommended for students interested in graphic design, animation, CAD/CAM, high processing demand applications Computer’s Video Capabilities Intel HD (High Definition) AMD or Nvidia Independent Integrated Graphics Processor Graphics Processors recommended for students interested in graphic design, animation, CAD/CAM, high processing demand applications Computers Internal Storage – 256GB Hard Drive SSD type drive recommended Hard Drive for processing power and reliability Computer’s Wired Ethernet Strongly recommended. May Wired network connections are Connection require the purchase of an 10x faster than wireless additional adapter or “Dongle” network connections Computer’s WiFi – Internet Intel Brand – Dual Band Wireless We do not recommend other Access Card Card capable of 802.11ac wireless network card brands, 2.4/5.0GHz Dual Band Wireless Intel is the only one that works Network Card reliably in the IMSA environment Computer’s WebCam Required, to support eLearning as necessary Computer’s USB Ports 3- USB Ports
    [Show full text]
  • Installation Pieter P
    Installation Pieter P Important:These are the installation instructions for developers, if you just want to use the library, please see these installation instructions for users. I strongly recommend using a Linux system for development. I'm using Ubuntu, so the installation instructions will focus mainly on this distribution, but it should work ne on others as well. If you're using Windows, my most sincere condolences. Installing the compiler, GNU Make, CMake and Git For development, I use GCC 11, because it's the latest version, and its error messages and warnings are better than previous versions. On Ubuntu, GCC 11 can be installed through the ppa:ubuntu-toolchain-r/test repository: $ sudo add-apt-repository ppa:ubuntu-toolchain-r/test $ sudo apt update $ sudo apt install gcc-11 g++-11 You'll also need GNU Make and CMake as a build system, and Git for version control. Now is also a good time to install GNU Wget, if you haven't already, it comes in handy later. $ sudo apt install make cmake git wget Installing the Arduino IDE, Teensy Core and ESP32 Core To compile sketches for Arduino, I'm using the Arduino IDE. The library focusses on some of the more powerful Arduino-compatible boards, such as PJRC's Teensy 3.x and Espressif's ESP32 platforms. To ensure that nothing breaks, tests are included for these boards specically, so you have to install the appropriate Arduino Cores. Arduino IDE If you're reading this document, you probably know how to install the Arduino IDE. Just in case, you can nd the installation instructions here.
    [Show full text]
  • The History of Computing in the History of Technology
    The History of Computing in the History of Technology Michael S. Mahoney Program in History of Science Princeton University, Princeton, NJ (Annals of the History of Computing 10(1988), 113-125) After surveying the current state of the literature in the history of computing, this paper discusses some of the major issues addressed by recent work in the history of technology. It suggests aspects of the development of computing which are pertinent to those issues and hence for which that recent work could provide models of historical analysis. As a new scientific technology with unique features, computing in turn can provide new perspectives on the history of technology. Introduction record-keeping by a new industry of data processing. As a primary vehicle of Since World War II 'information' has emerged communication over both space and t ime, it as a fundamental scientific and technological has come to form the core of modern concept applied to phenomena ranging from information technolo gy. What the black holes to DNA, from the organization of English-speaking world refers to as "computer cells to the processes of human thought, and science" is known to the rest of western from the management of corporations to the Europe as informatique (or Informatik or allocation of global resources. In addition to informatica). Much of the concern over reshaping established disciplines, it has information as a commodity and as a natural stimulated the formation of a panoply of new resource derives from the computer and from subjects and areas of inquiry concerned with computer-based communications technolo gy.
    [Show full text]
  • For Windows Lesson 0 Setting up Development Environment.Pdf
    LESSON 0 sets up development environment -- arduino IDE But.. e...... what is arduino IDE......? 0 arduino IDE As an open source software,arduino IDE,basing on Processing IDE development is an integrated development environment officially launched by Arduino. In the next part,each movement of the vehicle is controlled by the program so it’s necessary to get the program installed and set up correctly. By using arduino IDE,You just write the program code in the IDE and upload it to the Arduino circuit board. The program will tell the Arduino circuit board what to do. so,Where can we download arduino IDE? the arduino IDE? STEP 1: Go to https://www.arduino.cc/en/Main/Software and you will see below page. The version available at this website is usually the latest version,and the actual version may be newer than the version in the picture. STEP2: Download the development software that is suited for the operating system of your computer. Take Windows as an example here. If you are macOS, please pull to the end. You can install it using the EXE installation package or the green package. The following is the exe implementation of the installation procedures. Press the char “Windows Installer” 1 STEP3: Press the button “JUST DOWNLOAD” to download the software. The download file: STEP4: These are available in the materials we provide, and the versions of our materials are the latest versions when this course was made. Choose "I Agree" to see the following interface. 2 Choose "Next" to see the following interface.
    [Show full text]
  • Introduction to Arduino Software Pdf
    Introduction to arduino software pdf Continue Arduino IDE is used to write computer code and upload that code to a physical board. Arduino IDE is very simple, and this simplicity is probably one of the main reasons why Arduino has become so popular. We can certainly say that compatibility with Arduino IDE is now one of the basic requirements for the new microcontroller board. Over the years, many useful features have been added to Arduino IDE, and now you can manage third-party libraries and tips from IDE, and still keep the ease of programming board. The main Arduino IDE window is shown below, with a simple example of Blink. You can get different versions of Arduino IDE from the Download page on Arduino's official website. You have to choose software that is compatible with your operating system (Windows, iOS or Linux). Once the file is downloaded, unpack the file to install Arduino IDE. Arduino Uno, Mega and Arduino Nano automatically draw energy from either, USB connection to your computer or external power. Launch ARduino IDE. Connect the Arduino board to your computer with a USB cable. Some LED power should be ON. Once the software starts, you have two options: you can create a new project or you can open an existing project example. To create a new project, select file → New. And then edit the file. To open an existing project example, select → example → Basics → (select an example from the list). For an explanation, we'll take one of the simplest examples called AnalogReadSerial. It reads the value from the analog A0 pin and prints it.
    [Show full text]