install arduino ide - universiteit twentekokkeler/htsm master/arduino... · the arduino ide program...

16
APPENDIX A Install Arduino IDE In this chapter we show visually what steps are required to download and install the Arduino tools. Since you will be installing drivers in Windows (always a risky business), make sure you follow the instructions properly. A.1 Obtaining the Arduino IDE In this guide we assume you are using Windows 7. For Windows XP and Vista, the installation is similar but might differ slightly. Start by opening the Arduino website at www.arduino.cc (Figure A.1) and click Download from the menu. Save the file where you can easily find it, e.g. the Desktop or your Downloads folder (Figure A.2). Needless to say, you will need to download the Windows version of the tooling. After downloading, extract the tooling to a convenient location, in this case we extracted it to D\:\arduino-1.0.1-windows and created a shortcut from the Arduino IDE program to the Desktop (Figure A.3). A.1.1 Installing the drivers Now connect your Arduino UNO to your PC using the provided USB cable. Windows will attempt to install the drivers and will fail. To use the Arduino, we will have to install the correct drivers for it in Windows. Open the Device Manager by right clicking on Computer from your Desktop and select Manage, see Figure A.4. Locate the Arduino UNO under Device Manager and Other Devices. Right click on the Arduino UNO and select Update Driver Software..., see Figure A.4. In the next wizard, choose Browse my computer for driver software (Fig. A.5) and in the next step select the drivers folder from the location where you extracted the Arduino IDE (Fig. A.6). After some warning messages (depending on your version and flavor of Windows), you will see the confirmation window that the installation succeeded, see Figure A.8. Document version: rev. 242, build date 2015-03-10 1

Upload: tranbao

Post on 18-Mar-2018

236 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

APPENDIX AInstall Arduino IDE

In this chapter we show visually what steps are required to download and install the Arduinotools. Since you will be installing drivers in Windows (always a risky business), make sureyou follow the instructions properly.

A.1 Obtaining the Arduino IDE

In this guide we assume you are using Windows 7. For Windows XP and Vista, the installationis similar but might differ slightly.

Start by opening the Arduino website at www.arduino.cc (Figure A.1) and clickDownload from the menu. Save the file where you can easily find it, e.g. the Desktop or yourDownloads folder (Figure A.2). Needless to say, you will need to download the Windowsversion of the tooling.

After downloading, extract the tooling to a convenient location, in this case we extracted itto D\:\arduino-1.0.1-windows and created a shortcut from the Arduino IDE programto the Desktop (Figure A.3).

A.1.1 Installing the drivers

Now connect your Arduino UNO to your PC using the provided USB cable. Windows willattempt to install the drivers and will fail.

To use the Arduino, we will have to install the correct drivers for it in Windows. Openthe Device Manager by right clicking on Computer from your Desktop and select Manage,see Figure A.4.

Locate the Arduino UNO under Device Manager and Other Devices. Right click on theArduino UNO and select Update Driver Software..., see Figure A.4.

In the next wizard, choose Browse my computer for driver software (Fig. A.5) and in thenext step select the drivers folder from the location where you extracted the Arduino IDE(Fig. A.6). After some warning messages (depending on your version and flavor of Windows),you will see the confirmation window that the installation succeeded, see Figure A.8.

Document version: rev. 242, build date 2015-03-10 1

Page 2: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

2

Figure A.1: Arduino website

Figure A.2: Download the Arduino IDE package for Windows

Page 3: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

3

Figure A.3: Download the Arduino IDE package for Windows

Figure A.4: Open up the Device Manager in Windows

Page 4: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

4

Figure A.5: Locate the Arduino UNO device

A.1.2 Arduino Testing

After installing the drivers, the Arduino is now available as a serial port in Windows. Startthe Arduino IDE program using the shortcut you created before.

To check if the installation was a success, go to Tools and Serial Port, see figure A.9.You should see the serial port of the Arduino; select it to continue. If the Serial Port menuis grayed out, the Arduino was not installed properly.

Your Arduino UNO has a single LED connected to pin 13. To see if everything works, goto File, Examples, Basics and open Blink. Find and press the Upload button to compile andload the example into the Arduino UNO. You should now see the LED near pin 13 blink.

Page 5: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

5

Figure A.6: Start the driver update wizard

Page 6: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

6

Figure A.7: Search in the drivers from the Arduino IDE

Page 7: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

7

Figure A.8: Confirmation that the installation of the drivers succeeded

Page 8: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

8

Figure A.9: Confirm that the Arduino is indeed connected

Page 9: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

APPENDIX BSimplified C Grammar

Simplified C99 grammar, which is a subset of ISO/IEC 9899:1999. Students should be able to understandprograms that conform to these rules, at least. Note: whitespaces are not part of the language.

B.1 Grammar format

comments<thing> =

alternative 1alternative 2...

B.2 Program structure

<nothing> =

<program> =<global> <program><nothing>

<global> =<include-header><define-macro><type-declaration><variable-declaration> ;<function-declaration>

<include-header> =#include <library.h>#include "filename.h"

<define-macro> =#define <identifier> <constant>#define <identifier> ( <expression> )

Document version: rev. 242, build date 2015-03-10 9

Page 10: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

10

B.3 Variable declarations

<variable-declaration> =<base-type> <init-declarator-list>

<init-declarator-list> =<init-declarator><init-declarator> , <init-declarator-list>

<init-declarator> =<declarator><declarator> = <initialization>

<declarator> =<identifier>

* <declarator><declarator> [ ]<declarator> [ <decimal-constant> ]<declarator> [ <hex-constant> ]

<initialization> =<expression>{ }{ <initialization-list> }

<initialization-list> =<expression><expression> , <initialization-list>

<variable-declaration-list> =<variable-declaration> ; <variable-declaration-list><nothing>

B.4 Functions

<function-declaration> =<type> <identifier> ( ) { <command-list> }<type> <identifier> ( void ) { <command-list> }<type> <identifier> ( <argument-definition-list> ) { <command-list> }

<argument-definition-list> =<base-type> <declarator><base-type> <declarator> , <argument-definition-list>

<function-call> =<identifier> ( )<identifier> ( <argument-list> )

<argument-list> =<expression><expression> , <argument-list>

Page 11: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

11

B.5 Statements

<command-list> =<command> <command-list><nothing>

<command> =<variable-declaration> ;<statement>

<statement> ={ <command-list> }<optional-expression> ;<if-statement><switch-statement><loop><jump>

<statement-list> =<statement><statement> <statement-list>

<optional-statement-list> =<statement-list><nothing>

<if-statement> =if ( <expression> ) <statement>if ( <expression> ) <statement> else <statement>

<switch-statement> =switch ( <expression> ) { <case-list> }

<case-list> =<nothing>case <constant>: <optional-statement-list> <case-list>default: <statement-list>

<loop> =for ( <variable-declaration> ; <expression> ; <expression> ) <statement>for ( ; <optional-expression> ; <optional-expression> ) <statement>while ( <expression> ) <statement>do <statement> while ( <expression> ) ;

<jump> =break ;continue ;return <optional-expression> ;

B.6 Expressions

<optional-expression> =<expression><nothing>

Page 12: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

12

<expression> =<constant><identifier><expression> <binary-op> <expression><prefix-unary-op> <expression><expression> <postfix-unary-op><expression> <member-op> <identifier><expression> [ <expression> ]<function-call>( <type> ) <expression>( <expression> )

<binary-op> =<binary-relation><assignment-op><logical-op><bitwise-op><math-op>

<binary-relation> = == != > < >= <=<assignment-op> = = += -= /= *= &= |= %= ˆ= >>= <<= ∼=<logical-op> = && ||<bitwise-op> = & | ˆ >> <<<math-op> = + - / * %<prefix-unary-op> = ++ -- + - ! * & ∼<postfix-unary-op> = ++ --<member-op> = . ->

B.7 Types

<base-type> =<primitive-type>struct <identifier><identifier>

<type> =<base-type><type> *

<primitive-type> =voidcharshortunsigned shortintunsigned intlong long intunsigned long long intfloatdouble

<type-declaration> =typedef <base-type> <declarator> ;typedef struct { <variable-declaration-list> } <declarator> ;typedef struct <identifier> { <variable-declaration-list> } <declarator> ;struct <identifier> { <variable-declaration-list> } ;

Page 13: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

13

B.8 Identifiers

<identifier> =<alpha> <alpha-num-list>

<alpha-num> =<alpha><num>

<alpha-num-list> =<alpha-num> <alpha-num-list><nothing>

B.9 Constants

<alpha> = a-z A-Z<num> = 0-9<non-zero-num> = 1-9<hex> = 0-9 a-f A-F<any> = any character, including escaped ones, like \0, and \n

<constant> =<decimal-constant><float-constant><hex-constant><char-constant><string-constant>

<decimal-constant> =<num><non-zero-num> <decimal-body>

<decimal-body> =<num><num> <decimal-body>

<float-constant> =<decimal-constant> . <decimal-body>

<hex-constant> =0x <hex-body>

<hex-body> =<hex><hex> <hex-body>

<char-constant> =’<any>’

<string-constant> ="<many>"

<many> =<any> <many><nothing>

Page 14: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short
Page 15: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

APPENDIX CC Operators

Table C.1 lists all operators in C. The precedence rules indicate in which order operators areevaluated. For example:

x = a+b*1/2<<3 will first multiply b by 1, then divide by 2, then add the result to a,then the bitwise-shift, and then the assignment to x.

x = &a->b[c] will first take the member b of a, then take subscript c, then the address,and then the assignment.

!a || b && c will first calculate not a, then do a logical and of b and c, and thencalculate the logical or.

The associativity indicates in which order operators at the same precedence level areevaluated. For example, x = y = 1 will evaluate y = 1 first, because the operators shouldbe executed in right-to-left order.

Document version: rev. 242, build date 2015-03-10 15

Page 16: Install Arduino IDE - Universiteit Twentekokkeler/HTSM Master/Arduino... · the Arduino IDE program using the shortcut you created before. ... #include "filename.h" ... char short

16

Table C.1: C Operators

Precedence Operator Description Position Associativity

1

++ postfix increment postfix unary

left-to-right

-- postfix decrement postfix unary() function call postfix unary[] array subscript postfix unary. member of binary-> member of through pointer binary

2

++ prefix increment

prefix unary right-to-left

-- prefix decrement+ positive- negative! logical not∼ bitwise not

* dereference& address-of

(type) type castsizeof size-of

3* multiply

binary left-to-right/ divide% modulo

4+ add

binary left-to-right- subtract

5>> bitwise-shift right

binary left-to-right<< bitwise-shift left

6

> is greater than

binary left-to-right< is less than>= is greater than or equal<= is less than or equal

7== is equal

binary left-to-right!= is not equal

8 & bitwise and binary left-to-right

9 ˆ bitwise xor binary left-to-right

10 | bitwise or binary left-to-right

11 && logical and binary left-to-right

12 || logical or binary left-to-right

13 ?: conditional ternary right-to-left

14

= assignment

binary right-to-left

+= add and assign-= subtract and assign/= divide and assign

*= multiply and assign&= bitwise-and and assign|= bitwise-or and assign%= modulo and assignˆ= bitwise-xor and assign>>= shift-right and assign<<= shift-left and assign∼= bitwise-not and assign

15 , comma binary left-to-right