Error Compiling the Code Please Try Again Later Google Foobar

Contents

  1. ane Questions, Answers and Review
  2. 2 Getting Started with Arduino
    1. 2.i Your Arduino Kit
    2. ii.2 Powering Upward the Arduino
    3. two.3 Installing the Software
    4. 2.4 Practise ane: Installing the Arduino IDE (10m)
    5. two.five Verifying the Installation
  3. three Exploring the Blink Sketch
    1. three.1 Sketches and Comments
    2. 3.ii Arduino Commands
    3. three.3 Arduino Functions
    4. 3.4 Using the Reference
    5. three.v Exercise ii: Changing the Delay (6m)
    6. 3.six Summary
  4. 4 Compiling and Debugging Sketches
    1. 4.ane Compiling Sketches
    2. 4.2 Syntax Errors
    3. iv.3 Using the Series Monitor
    4. 4.4 Exercise 3: Errors and Debugging (10m)
    5. 4.five Summary
  5. five Wrap Upwards and Reminders


Questions, Answers and Review

  • Questions from last class?
  • Questions about homework?
  • Did yous bring your Arduino kit today?
  • Whatever problems obtaining the Arduino kit?

^ superlative

Getting Started with Arduino

Learner Outcomes

At the end of the lesson the student will be able to:

  • Power up an Arduino
  • Compile a sketch

Your Arduino Kit

Recommended Arduino Kit

  • Your assignment for today was to bring your Arduino kit to class
  • If you do not have a kit, partner with someone who does

Arduino Kit Contents

The required kit includes components like these:

  • Arduino Uno
  • Solderless breadboard
  • USB cablevision
  • Motors and servo
  • Piezo Cablegram
  • 74HC595 Shift Register IC
  • Contrasted LEDs and resistors
  • Sensors for light, rut, pressure level
  • Relay, potentiometer, push, transistors, diode, wires

Assembling the Kit

  • The kit comes with an acrylic holder
  • Attach the Arduino to the indicated side with the screw and nuts provided
  • Attach the Breadboard to the other side by removing the backing from the adhesive and pressing into place
  • Make certain the text on both the Arduino and breadboard faces the same style

More than Information

  • Hardware Overview: a video tour of the Arduino lath

^ tiptop

Powering Up the Arduino

  • An Arduino board usually comes with a preinstalled blink program
  • All we need to exercise is supply power
  • Using the cable, plug the Arduino into the USB port on a reckoner
  • Look for the blinking LED, which is marked: L

Applying Power to the Arduino

Connecting the Arduino to power

Source: www.arduinoclassroom.com

Activity (3m)

  1. Plug in your Arduino board to your reckoner using the USB cablevision.
  2. Verify the "L" LED is blinking.
  3. If yous have problems, inquire a classmate or the instructor for help.

When finished, delight help those around you.

^ top

Installing the Software

  • To control the Arduino, we must upload sketches
  • Sketch is the Arduino word for plan
  • The Arduino site has software installation instructions for:
    • Windows
    • Mac Os Ten
    • Linux
  • The software is known as the Arduino IDE (Integrated Development Environment)
  • Notation that the Arduino IDE is installed on school computers in the classroom and the Stem heart

^ top

Exercise one: Installing the Arduino IDE (10m)

In this do we install the Arduino IDE (Integrated Development Environment) on a computer.

Specifications

  1. Follow the software installation instructions for your computer:
    • Windows
    • Mac Bone X
    • Linux
  2. When finished uploading the Blink sketch, you should run across the pin 13 (L) LED on the lath start to blink
  3. If y'all have problems, inquire a classmate or the teacher for help.

When finished, please help those around you.

^ top

Verifying the Installation

  • At this point you should have:
    1. Downloaded and installed the software
    2. Opened the blink example
    3. Selected a board type and port
    4. Compiled and uploaded the Blink program
  • Has anyone not completed these steps?
  • Otherwise, y'all now know how to become prepare and set up to go with Arduino!

^ summit

Exploring the Blink Sketch

Learner Outcomes

At the end of the lesson the pupil will be able to:

  • Describe what is meant by a sketch
  • Depict and brand apply of comments
  • Telephone call functions to execute commands
  • Look up what functions do in the language reference
  • Write the required two office definitions for Arduino sketches

Sketches and Comments

  • Let united states of america walk through the Blink sketch
  • Sketches contain C/C++ programming language lawmaking
  • By default, lawmaking executes sequentially, tiptop to bottom, left to correct
  • To read program lawmaking, start at the tiptop and follow the lawmaking downward, similar a book

Coding Comments

  • A useful tool in whatever programming language is the ability to leave notes to yourself and other humans
  • We use comments to document blocks of code and to describe unusual code
  • Arduino has two main styles of comments:
    1. C mode Comments
    2. C++ manner Comments
  • Both take their uses, which nosotros now explore

C mode Comments

  • The first role of the Blink program is a C-manner "block" annotate (see beneath)
  • Comments are notes to humans, like you and me
  • C-style comments start with /* and end with */
    /* this is a comment */              
  • Everything betwixt the /*...*/ is ignored by the compiler
  • All programs should have this C-mode comment block -- Why?

C-Style Block Comment Instance

/**
CS-11 Projection 2B
Name: rectangle
Purpose: Calculates the area of a rectangle from user input.

@author Ed Parrish
@version 1.0 8/04/fifteen
*/

C++ Style Comments

  • C++ has a second type of comment
  • C++comment starts with // and lasts to end of the line
    // this is a comment              
  • How many C++ way comments can you notice in the post-obit code? What are they used for?

Instance Code with C++ Mode Comments

// the setup part runs once when you press reset or ability the board void setup() {   // initialize digital pin 13 as an output.   pinMode(thirteen, OUTPUT); }  // the loop part runs over and over again forever void loop() {   digitalWrite(13, HIGH);   // plow the LED on (HIGH is the voltage level)   delay(chiliad);              // expect for a second   digitalWrite(thirteen, LOW);    // turn the LED off by making the voltage Low   filibuster(1000);              // wait for a second }          

Check Yourself

  1. True or false: comments are notes to the compiler.
  2. Which of the following indicates that a single line of commentary will follow it?
    1. /*
    2. /**
    3. //
    4. */
  3. Which of the post-obit should be used at the top of each program file to draw the program?
    1. /*..*/
    2. //...//
    3. //...
    4. #...

^ top

Arduino Commands

  • The following is the Blink code with comments removed
  • This remaining code is executed, later compiling, by the estimator

Glimmer Lawmaking Without Comments

void setup() {    pinMode(13, OUTPUT); }  void loop() {   digitalWrite(13, HIGH);   delay(1000);   digitalWrite(13, Low);   delay(1000); }          

Programs

  • Programs are a listing of commands similar those shown higher up
  • Commands are carried out in the gild they are written (by default)
  • Commands are listed between the curly braces {...}
  • These groups of commands are known equally a office
  • A part is a grouping of statements with a name that tin can be called in programme
  • In C/C++, the statements are grouped into a block between the curly braces {...}

Examining the Commands

  • Here are some of the commands, one per line:
    digitalWrite(13, HIGH); delay(1000); digitalWrite(thirteen, LOW); delay(1000);              
  • Each line does something
  • Showtime line sets the output of pivot 13 to HIGH, which turns on power to the LED
  • 2nd line waits yard milliseconds (ane 2d)
  • What does the 3rd line exercise? 4th line?
  • Find the way words are written and the punctuation
  • The organisation of words and punctuation is known as syntax
  • Notice that most Arduino C/C++ commands end in a semicolon ";"
  • A semicolon ";" is like the a flow in a judgement of English language, marking the end of the phrase

Arduino Names

  • Recall our snippet of code from the Glimmer program:
    digitalWrite(13, HIGH); filibuster(1000); digitalWrite(13, Low); delay(1000);              
  • Program languages are picky most syntax details like names
  • Names must exist written as a unmarried word (no spaces)
  • digitalWrite is the name of a function that does something -- sets the output of a pin
  • Names are example-sensitive: digitalWrite, non DigitalWrite or Digitalwrite

Check Yourself

  1. Which of the following is a command?
    1. /** expert option! */
    2. // some other swell pick!
    3. digitalWrite(13, HIGH);
    4. digitalWrite(13, Low)
  2. The purpose of the following command is to ________.
    delay(chiliad);              
  3. True or false: names in C/C++ are case sensitive.

^ top

Arduino Functions

  • Recall our snippet of lawmaking from the Blink program:
    digitalWrite(thirteen, High); delay(one thousand); digitalWrite(13, Depression); delay(1000);              
  • Considering digitalWrite is a function it has parenthesis
  • Thus we commonly write a function proper name followed by a set up of parenthesis: digitalWrite()
  • Function digitalWrite() must know which pivot to ready and whether to set it HIGH or Depression
  • These two pieces of information are called arguments
  • Arguments are said to be passed to a part
  • Writing a function name with its arguments is known as calling (aka invoking) a function

Required Office Definitions

  • Arduino commands are organized into two groups
    void setup() {...} void loop() {...}              
  • These two groups are known as function definitions
  • Every sketch must have these two function definitions

Functions setup() and loop()

  • Notice the word void and the curly braces in the required functions:
                    void                setup()                {...}                void                loop()                {...}              
  • These ii parts of the syntax means we are writing function definitions for Arduino to call
  • Function setup() runs in one case when the sketch starts
  • Function loop() runs forever
  • We identify our commands inside the {...} of these part definitions
  • We will hash out how to write other function definitions after

Check Yourself

  1. Of the post-obit, the valid C/C++ names are ________.
    1. foo
    2. foo bar
    3. bar none
    4. fooBar
  2. Information passed to a function is known equally a(northward) ________.
  3. The following role call has how many arguments?
    foo(0, 1, two);              
    1. 0
    2. 1
    3. 2
    4. 3
  4. The two required part definitions in Arduino are ________ and ________.

^ acme

Using the Reference

  • Arduino has many built-in functions
  • How practice we know which ones to phone call?
  • We employ the reference

    Help > Reference

Activeness (3m)

Open the reference and take a few minutes to see how to navigate among the various terms and their web pages.

Finding Terms in the Reference

Arduino software allows us to highlight a word and find it automatically in the reference.

Activity (5m)

  1. In the Blinky program, highlight the term pinMode.
  2. Open the Aid carte and click on Detect Reference.

    The Arduino Reference opens in a browser on the entry for the term.

  3. Take a few minutes to await upwardly a few terms.
  4. If you have bug, ask a classmate or the teacher for help.

When finished, please help those around y'all.

^ top

Exercise 2: Changing the Filibuster (6m)

In this practise nosotros alter and recompile code.

Specifications

  1. Outset the Arduino IDE.
  2. Open the Glimmer sketch.

    File > Examples > Basics > Glimmer

  3. Save the sketch every bit blink2 to a convenient place like the Desktop or your Arduino folder.

    This will create a file named blink2.ino in a binder named blink2.

  4. Experiment with the delays and change them to something besides thou milliseconds.
  5. Compile and upload your code afterwards irresolute the delays. Verify button Upload button

    If you have bug, inquire a classmate or the instructor for help.

  6. Submit your blink2.ino file as office of the next homework.

When finished, delight help those around you.

^ top

Summary

  • Sketches contain C/C++ programming language code
  • By default, code executes sequentially, top to bottom, left to right
  • We tin can add comments to our lawmaking to leave notes to humans reading the code
  • We add together comments to certificate blocks of code and to describe unusual code
  • There are 2 main types of comments:
    • C fashion: /* this is a annotate */
    • C++ style: // this is a comment
  • Programs are a list of commands like those shown above
  • Commands are carried out in the guild they are written (by default)
  • Program languages are picky near syntax details similar names
  • Names must be written as a single word (no spaces)
  • Arduino has several functions that we can call (aka invoke)
  • We look up which commands to phone call and what they do in the reference
  • In addition to built-in functions to call, we must write two functions for every sketch
    void setup() {...} void loop() {...}              
  • We identify our commands inside the {...} of these function definitions

^ tiptop

Compiling and Debugging Sketches

Learner Outcomes

At the finish of the lesson the student will be able to:

  • Compile a sketch
  • Empathize and correct basic errors
  • Use the series monitor

Compiling Sketches

  • When nosotros write a program, we showtime with source code
  • Source code is a text listing of C/C++ commands in human readable class
  • When we press the Verify button nosotros start the compile process

    Verify button

  • Compiling means that nosotros interpret source code into machine code
  • Source code is the man understandable text within the sketch
  • Machine code is what the computer understands
  • When compiling is successful, we will run across a message at the bottom of the source code window like:

    Done compiling

  • We tin encounter the period of the compiling process in the following image
  • The executable program at the end tin can be uploaded to Arduino's flash memory

Compilation Procedure

Compilation process

Running a Compiled Programme

  • To run or execute a program we printing the Upload button

    Upload button

  • The compiled lawmaking is transferred to the Arduino'south flash memory
  • After the upload procedure completes, the Arduino boards starts executing the code

Check Yourself

  1. Another word for "verifying" on the Arduino is ________.
  2. Code that humans type is known as ________ code.
  3. Code that computers understand is known every bit ________ lawmaking.

^ peak

Syntax Errors

  • Equally we develop programs, nosotros make errors
  • Often the error is because we left out a grapheme or misspelled a word
  • In programming, one minor mistake ways the program does not work

Detecting Syntax Errors

  • The Arduino IDE reports syntax errors plant during compiling
  • Syntax errors are caused by incorrectly placed words or punctuation
  • As an example, we tin effort compiling a bare sketch
  • When nosotros do we become a bulletin: Error compiling
  • Nosotros go more than data about the error by pressing Re-create fault messages and pasting the error text into a text editor

Compiler Mistake

Example compiler error message

Text Editors

  • A text editor is a plan that allows a user to view and edit plain text
  • The Arduino IDE has a built-in text editor for working with source code
  • Sometimes, like for error messages, it is convenient to use a second text editor
  • There are many text editors to choose from such every bit:
    • Windows: TextPad, Notepad, WordPad
    • Mac: TextEdit, BBEdit, Text Wrangler, ...
    • Linux/Unix: EMACS, XEmacs, VIM, pico, nano, ...
    • More data: List of text editors
  • Nosotros use TextPad in the classroom and you can download it for apply at home

Lawmaking with a Syntax Mistake

  • The following lawmaking has a syntax error
  • Can you spot the mistake?
void setup() {    pinMode(thirteen, OUTPUT) }  void loop() {   digitalWrite(13, HIGH);   delay(1000);   digitalWrite(thirteen, Low);   filibuster(yard); }        

Another Syntax Error

  • A common syntax error is a missing semicolon ';'
  • Removing the start ';' in the higher up sketch produces the error:
    blink.ino: In part 'void setup()': blink:iii: error: expected ';' before '}' token expected ';' before '}' token            
  • The mistake message shows many key details, like:
    blink:3            
  • The 3 is the line number of the error
  • Line numbers are very useful for locating errors
  • Expect at number of line reported to find error on or before that line

Debugging Syntax Errors

First computer bug

  • Errors in programs are known euphemistically equally "bugs"
  • The process of removing errors is known as debugging
    • Grace Hopper popularized the term debugging
  • First step is to read the error message and find the line number reported
  • The fault is usually on the reported line or preceding lines
  • Afterwards fixing the first problem -- recompile
  • Other reported errors are often caused by the starting time fault

Bank check Yourself

  1. To know if our sketch is OK we ________.
  2. Errors in the syntax of lawmaking is known every bit ________ errors.
  3. True or false: line numbers are useful for finding errors.

^ acme

Using the Serial Monitor

  • Arduino has another tool to assistance usa debug code called the Serial Monitor
  • The Series Monitor allows our reckoner to brandish messages sent past the Arduino board
  • Information is transmitted using the USB cable
  • We view the information in the Serial Monitor window
  • Nosotros open up the Series Monitor past pressing the special button or using the menus:

    Tools > Serial Monitor

Location of the Series Monitor Button on the Arduino IDE

Serial monitor button

Printing to the Serial Monitor

  • To transmit to the Serial Monitor, we add the post-obit command to setup():
    Serial.begin(9600);            
  • To print to the monitor, we add the following command to our code:
    Serial.println(arg)            
  • The println() control expects one argument which is the value to print
  • Nosotros can print values similar 123 or text
  • Nosotros must enclose any text we impress in double-quote marks
  • Notice how the TX LED flashes every time Series.println() is called
  • We will explore how to use the series monitor in the next practise

Example Code for Press to the Serial Monitor

void setup() {   Serial.begin(9600); }  void loop() {   Series.println("Hi earth!");   delay(1000); }        

More Information

  • Using the Arduino Series Port to Transmit Data: video

^ top

Do three: Errors and Debugging (10m)

In this exercise nosotros compile, fix errors and add print commands to code.

Specifications

  1. Start the Arduino IDE.
  2. Copy the following lawmaking into the Arduino IDE and salvage the sketch as buggy.
  3. Find and right the lawmaking errors.

    If yous have problems, ask a classmate or the teacher for help.

  4. Add together ii print commands to display the value "On" or "Off" afterwards every LED modify and before the delay command.

    If you accept problems, ask a classmate or the teacher for assistance.

  5. Submit your buggy.ino file as part of the next homework.

When finished, please help those effectually y'all.

Buggy Code

void setup() {   pinMode(13, OUTPUT);   Serial.beggin(9600); }  void loop() {   digitalWrite(13, HIGH)   Delay(g);   digitalwrite(13, LOW);   delay(grand); }        

^ meridian

Summary

  • When we write a program, we outset with source code
  • Source code is a text listing of C/C++ commands in human being readable class
  • When nosotros printing the Verify button nosotros start the compile procedure
  • Compiling means that nosotros translate source lawmaking into machine lawmaking
  • Source code is the human understandable text inside the sketch
  • Car code is what the calculator understands
  • Nosotros upload the machine code to the Arduino
  • Equally we develop programs, we make errors
  • The Arduino IDE reports syntax errors found during compiling
  • Often the mistake is because we left out a character or misspelled a give-and-take
  • Nosotros find the error by first looking for the line number in the error message
  • The mistake is on or before the reported line
  • After fixing the first problem we recompile the source code
  • Another tool for finding errors is the serial monitor
  • With the series monitor nosotros can print information about our programme as it runs

^ top

Wrap Up and Reminders

  • For next homework, see schedule
  • When form is over, please shut down your computer.
  • Complete unfinished exercises from today earlier the next form coming together

^ top

hernandezmortan.blogspot.com

Source: https://sites.google.com/a/cabrillo.edu/cs-11m/schedule/arduino-start

0 Response to "Error Compiling the Code Please Try Again Later Google Foobar"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel