主要内容

更新源和标头文件的路径

  1. 在matlab.®编辑,打开Colorsensor.m.文件。

  2. 更新buildinfo.具有以下代码的方法。

    方法(静止的) ...功能UpdateBuildInfo(BuildInfo,Context)如果context.iscodegentarget('RTW'的)%更新buildinfo.srcdir = fullfile(fileparts(mfilename('完整路径')),'src');champtedir = fullfile(fileparts(mfilename('完整路径')),'包括');libdir = fullfile(fileparts(mfilename('完整路径')),'图书馆');%包括标题文件AddIncleudePaths(BuildInfo,包括的人);addincludepaths(BuildInfo,libdir);%包括源文件addsourcefiles(buildinfo,'colorsensor.cpp',srcdir);addsourcefiles(buildinfo,'adafruit_tcs34725.cpp',libdir);boardinfo = arduino.金宝appsupportpkg.getboardInfo;转变BoardInfo.Architecture案子'avr'%添加SPI库 - 基于AVRiderootpath = arduino.金宝appsupportpkg.getavrroot;addincludepaths(fullfile(iderootpath,'硬件''Arduino''avr''图书馆''spi''src'));srcfilepath = fullfile(iderootpath,'硬件''Arduino''avr''图书馆''spi''src');filenametoadd = {'spi.cpp'};addsourcefiles(buildinfo,filenametoadd,srcfilepath);%添加线/ I2C库 - 基于AVRaddincludepaths(fullfile(iderootpath,'硬件''Arduino''avr''图书馆''金属丝''src'));addincludepaths(fullfile(iderootpath,'硬件''Arduino''avr''图书馆''金属丝''src''效用'));srcfilepath = fullfile(iderootpath,'硬件''Arduino''avr''图书馆''金属丝''src');filenametoadd = {'wire.cpp'};addsourcefiles(buildinfo,filenametoadd,srcfilepath);srcfilepath = fullfile(iderootpath,'硬件''Arduino''avr''图书馆''金属丝''src''效用');filenametoadd = {'twi.c'};addsourcefiles(buildinfo,filenametoadd,srcfilepath);案子“山姆”%添加SPI库 - 基于SAMlibsampath = arduino.金宝appsupportpkg.getsamlibraryroot;AddIncleudePaths(Fullfile(Libsampath,'spi''src'));srcfilepath = fullfile(libsampath,'spi''src');filenametoadd = {'spi.cpp'};addsourcefiles(buildinfo,filenametoadd,srcfilepath);%添加线/ I2C库 - 基于SAMAddIncleudePaths(Fullfile(Libsampath,'金属丝''src'));srcfilepath = fullfile(libsampath,'金属丝''src');filenametoadd = {'wire.cpp'};addsourcefiles(buildinfo,filenametoadd,srcfilepath);案子'samd'%添加SPI库 - 基于SAMDlibsamdpath = arduino.金宝appsupportpkg.getsamdlibraryroot;AddIncludePaths(Fullfile(LibsamdPath,'spi'));srcfilepath = fullfile(libsamdpath,'spi');filenametoadd = {'spi.cpp'};addsourcefiles(buildinfo,filenametoadd,srcfilepath);%添加线/ I2C库 - 基于SAMDAddIncludePaths(Fullfile(LibsamdPath,'金属丝'));srcfilepath = fullfile(libsamdpath,'金属丝');filenametoadd = {'wire.cpp'};addsourcefiles(buildinfo,filenametoadd,srcfilepath);除此以外警告('意外的板类型。再检查一遍。'的)结尾结尾结尾......结尾

在下一节中,您将设置输出端口属性

也可以看看

|||