/*****************************************************************************
* | File : README.txt
* | Author : Waveshare team
* | Function : user's guidance
* | Info :
*
*----------------
* | This version: V1.0
* | Date : 2018-09-04
* | Info : Basic version
*
******************************************************************************/
/*
*中文
*
**/
此例程对应的产品可以在我们的官网上搜索到:
http://www.waveshare.net/shop/index.htm
找到对应的产品,一般为本例程打包的名称。
例如:
Motor_Driver_HAT_code,
那么对应的产品为:Motor Driver HAT
可以找到相关的产品资料,
如用户手册,数据手册,原理图,配套的软件,以及一些基础教程等等。
本例程目录结构为:
├── bin
│ ├── DEV_Config.o
│ ├── main.o
│ ├── MotorDriver.o
│ └── PCA9685.o
├── Makefile
├── motor
├── obj
│ ├── Debug.h
│ ├── DEV_Config.c
│ ├── DEV_Config.h
│ ├── main.c
│ ├── MotorDriver.c
│ ├── MotorDriver.h
│ ├── PCA9685.c
│ └── PCA9685.h
└── README.txt
其中:
/bin:
makefile生成的目标文件.o,不需要理会
Makefile: 为工程的编译规则,执行 make,工程将会自动编译并生成可执行文件。
motor: 可执行文件,执行:sudo ./motor 运行程序。
Obj/:为工作目录,其下定义了多个函数,其中:
Debug.h: 此函数为调试头文件,把其中 USE_DEBUG 定义为 1,即可使用 DEBUG()来打印调试信息,与 printf()的使用是一样的;
DEV_Config.c(.h): 定义了树莓派的管脚及通信方式,根据 BCM2835 与 WiringPi 的不同而不同;
PCA9685.c(.h): 为PCA9685芯片的驱动程序,通过I2C控制来输出16路PWM;
MotorDriver.c(.h): 电机驱动芯片TB6612FNG驱动,控制两个电机;
main.c:主函数,
/*
*English
*
**/
The products corresponding to this routine can be found on our official website:
https://www.waveshare.com/
Find the corresponding product, which is generally the name packaged for this routine.
E.g:
Motor_Driver_HAT_code,
Then the corresponding product is: Motor Driver HAT
You can find related product information.
Such as user manuals, data sheets, schematics, supporting software, and some basic tutorials.
The directory structure of this routine is:
├── bin
│ ├── DEV_Config.o
│ ├── main.o
│ ├── MotorDriver.o
│ └── PCA9685.o
├── Makefile
├── motor
├── obj
│ ├── Debug.h
│ ├── DEV_Config.c
│ ├── DEV_Config.h
│ ├── main.c
│ ├── MotorDriver.c
│ ├── MotorDriver.h
│ ├── PCA9685.c
│ └── PCA9685.h
└── README.txt
among them:
/bin:
The target file generated by the makefile.o, do not need to pay attention to
Makefile: For the compilation rules of the project, execute make, the project will automatically compile and generate the executable file.
Motor: Executable, execute: sudo ./motor Run the program.
Obj/: is a working directory, under which multiple functions are defined, where:
Debug.h: This function is a debug header file. Defining USE_DEBUG to 1 can use DEBUG() to print debugging information, which is the same as printf().
DEV_Config.c(.h): defines the pin and communication method of the Raspberry Pi, which varies according to BCM2835 and WiringPi;
PCA9685.c(.h): For the driver of the PCA9685 chip, output 16-channel PWM through I2C control;
MotorDriver.c (.h): Motor drive chip TB6612FNG drive, control two motors;
Main.c: main function,