Arduino - v.1.0
- 2 .
Arduino
Arduino?
Arduino , AVR ARM (, , ) , .
Arduino Uno ( 1) AVR- Amtel Atmega 328P.
1 Arduino Uno
, . , ( !) ( ).
Arduino : , USB, , / , , , , , USB/UART . Arduino , - .
AVR- 1. : , , , , , : UART, SPI, 3-wire . , , , , , .
1 AVR-
Arduino
, , .
arduino.cc Arduino IDE ( ).
.
USB-.
Tools . ( Arduino Due programming port )
Tools COM- . , , . COM-1 COM- . , COM5. , , .
, / (File/Examples) Arduino IDE. blink. , 13.
|
|
int ledPin = 13;
void setup ()
{
pinMode (ledPin, OUTPUT);
}
void loop ()
{
digitalWrite (ledPin, HIGH);
delay (1000);
digitalWrite (ledPin, LOW);
delay (1000);
}
( ).
. Arduino ( ++), , Processing/Wiring.
int ledPin = 13
ledPin 13.
void setup ()
{
..
}
- setup (). setup , . , () .
pinMode (ledPin, OUTPUT);
/ , ledPin = 13. OUTPUT , .
void loop ()
{
..
}
- , , setup (), , , . . Arduino, . setup () , loop () , . loop () , , , , .
, , .
( c++ Csharp ..) " ". .
.
//
/*
*/
() | ||
[ ] | ||
. | ( ) | |
-> | ||
! | ||
~ | ||
- | ||
++ | i++; | |
-- | i--; | |
& | ||
* | ||
() | x= (float) a; | |
sizeof() | ||
* | ||
/ | ||
% | ||
+ | ||
- | ||
<< | ||
>> | ||
< | , | |
<= | ||
> | , | |
>= | ||
= = | ||
!= | ||
& | "" | |
^ | "" | |
| | "" | |
&& | "" | |
|| | "" | |
?: | () | |
= | ||
+=, - =, *=, /=, %=, <<=,>>=, &=, |=, ^= | *= b (.. a = a * b) |
|
|
o
o
o
o
o
o (void)
o
o
o
unsigned char 0...255 | char -128...127 | |
unsigned short 0...65535 | short -32768...32767 | |
unsigned int | int | |
unsigned long int | long int |
4 : m, , p, .
m |
.
( ):
- | |||||
float | 30...23 | 22...0 | |||
double | 62...52 | 51...0 | |||
- | longdouble | 78...64 | 62...0 |
: -178,125 float:
:
17810 = 101100102.
0,12510 = 0,0012.
178,12510 = 10110010,0012=1,01100100012111
Arduino :
char , ;
int , ;
float ;
double .
, :
char esc = '\\';
int i = 0;
int limit = MAXLINE+1;
floateps= 1.0e-5;
boolean
:true/false( ).
/a ( Arduino)
/a, .
/
digitalWrite()
digitalRead()