概述
淘宝店铺:http://robotstudio.taobao.com 群号: 259189548
Arduino语言注解Arduino语言是建立在C/C++基础上的,其实也就是基础的C语言,Arduino语言只不过把AVR单片机(微控制器)相关的一些参数设置都函数化,不用我们去了解他的底层,让我们不了解AVR单片机(微控制器)的朋友也能轻松上手。
关键字:
if
if...else
for
switch case
while
do... while
break
continue
return
goto
语法符号:
;
{}
//
运算符:
=
+
-
*
/
%
==
!=
<
>
<=
>=
&&
||
!
++
--
+=
-=
*=
/=
数据类型:
boolean
char
byte
int
unsigned int
long
unsigned long
float
double
string
array
void
数据类型转换:
char()
byte()
int()
long()
float()
常量:
HIGH | LOW
INPUT | OUTPUT
true | false
结构
void setup()
void loop()
功能
数字 I/O
pinMode(pin, mode)
digitalWrite(pin, value)
int digitalRead(pin)
模拟 I/O
int analogRead(pin)
analogWrite(pin, value) - PWM
扩展 I/O
shiftOut(dataPin, clockPin, bitOrder, value)
unsigned long pulseIn(pin, value)
时间函数
unsigned long millis()
delay(ms)
delayMicroseconds(us)
数学函数
min(x, y)
max(x, y)
abs(x)
constrain(x, a, b)
map(value, fromLow, fromHigh, toLow, toHigh)
pow(base, exponent)
sq(x)
sqrt(x)
三角函数
sin(rad)
cos(rad)
tan(rad)
随机数函数
randomSeed(seed)
long random(max)
long random(min, max)
外部中断函数
attachInterrupt(interrupt, , mode)
detachInterrupt(interrupt)
中断使能函数
interrupts()
noInterrupts()
串口收发函数
Serial.begin(speed)
int Serial.available()
int Serial.read()
Serial.flush()
Serial.print(data)
Serial.println(data)
官方库文件
EEPROM - EEPROM读写程序库
Ethernet - 以太网控制器程序库
LiquidCrystal - LCD控制程序库
Servo - 舵机控制程序库
SoftwareSerial - 任何数字IO口模拟串口程序库
Stepper - 步进电机控制程序库
Wire - TWI/I2C总线程序库
Matrix - LED矩阵控制程序库
Sprite - LED矩阵图象处理控制程序库
非官方库文件
DateTime - a library for keeping track of the current date and time in software.
Debounce - for reading noisy digital inputs (e.g. from buttons)
Firmata - for communicating with applications on the computer using a standard serial protocol.
GLCD - graphics routines for LCD based on the KS0108 or equivalent chipset.
LCD - control LCDs (using 8 data lines)
LCD 4 Bit - control LCDs (using 4 data lines)
LedControl - for controlling LED matrices or seven-segment displays with a MAX7221 or MAX7219.
LedControl - an alternative to the Matrix library for driving multiple LEDs with Maxim chips.
Messenger - for processing text-based messages from the computer
Metro - help you time actions at regular intervals
MsTimer2 - uses the timer 2 interrupt to trigger an action every N milliseconds.
OneWire - control devices (from Dallas Semiconductor) that use the One Wire protocol.
PS2Keyboard - read characters from a PS2 keyboard.
Servo - provides software support for Servo motors on any pins.
Servotimer1 - provides hardware support for Servo motors on pins 9 and 10
Simple Message System - send messages between Arduino and the computer
SSerial2Mobile - send text messages or emails using a cell phone (via AT commands over software serial)
TextString - handle strings
TLC5940 - 16 channel 12 bit PWM controller.
X10 - Sending X10 signals over AC power lines
以上库文件都需要下载到编译环境(如下目录:arduino-0011hardwarelibraries)中才能使用。
最后
以上就是光亮夏天为你收集整理的Arduino 编程语言手册(简单版)的全部内容,希望文章能够帮你解决Arduino 编程语言手册(简单版)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复