arduino的相关知识

基础知识

引脚相关

  1. pinMode(pin, mode)
    引脚定义,例如
pinMode(7, INPUT) 

将引脚7定义为输入模式

  1. digitalWrite(pin, value)
    数字IO口输出电平定义函数,需要先经过pinMode(pin, mode) 声明才能生效

  2. int digitalRead(pin)
    数字IO口读取电平函数

  3. int analogRead(pin)
    模拟IO口读取函数

  4. analogWrite(pin, value)
    数字IO口PWM输出函数

时间相关

  1. unsigned long millis()
    程序运行到现在的毫秒数,最大可50天
  2. delay(ms)
    延迟毫秒数
  3. delayMicroseconds(us)
    延迟微妙数

数学函数

  1. min(x, y)
    求最小值,返回最小值
  2. max(x, y)
    求最大值,返回最大值
  3. constrain(x, a, b)
    约束函数,x变量位于a和b之间,小于a返回a,大于b返回b

随机函数

  1. long random(max)
    随机函数,获取到大于等于0,小于max的数

串口函数

  1. Serial.begin(speed)
    串口定义波特率
  2. int Serial.read()
    读串口并返回收到的参数,读取1byte的序列资料
  3. Serial.print(data)
    串口输出数据,默认十进制
  4. Serial.print(data, encoding)
    串口输出数据,提供编码选项,默认十进制
  5. Serial.println(data)
    串口输出数据,跟随一个回车和换行符

官方库文件

  1. EEPROM - EEPROM读写程序库
  2. Ethernet - 以太网控制器程序库
  3. LiquidCrystal - LCD控制程序库
  4. Servo - 舵机控制程序库
  5. SoftwareSerial - 任何数字IO口模拟串口程序库
  6. Stepper - 步进电机控制程序库
  7. Wire - TWI/I2C总线程序库
  8. Matrix - LED矩阵控制程序库
  9. Sprite - LED矩阵图象处理控制程序库

非官方文件

  1. DateTime - a library for keeping track of the current date and time in software.
  2. Debounce - for reading noisy digital inputs (e.g. from buttons)
  3. Firmata - for communicating with applications on the computer using a standard serial protocol.
  4. GLCD - graphics routines for LCD based on the KS0108 or equivalent chipset.
  5. LCD - control LCDs (using 8 data lines)
  6. LCD 4 Bit - control LCDs (using 4 data lines)
  7. LedControl - for controlling LED matrices or seven-segment displays with a MAX7221 or MAX7219.
  8. LedControl - an alternative to the Matrix library for driving multiple LEDs with Maxim chips.
  9. Messenger - for processing text-based messages from the computer
  10. Metro - help you time actions at regular intervals
  11. MsTimer2 - uses the timer 2 interrupt to trigger an action every N milliseconds.
  12. OneWire - control devices (from Dallas Semiconductor) that use the One Wire protocol.
  13. PS2Keyboard - read characters from a PS2 keyboard.
  14. Servo - provides software support for Servo motors on any pins.
  15. Servotimer1 - provides hardware support for Servo motors on pins 9 and 10
  16. Simple Message System - send messages between Arduino and the computer
  17. SSerial2Mobile - send text messages or emails using a cell phone (via AT commands over software serial)
  18. TextString - handle strings
  19. TLC5940 - 16 channel 12 bit PWM controller.
  20. X10 - Sending X10 signals over AC power lines
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值