Arduino1.0无法使用以前的库文件(WProgram.h)

本文解决了在Arduino 1.0版本中遇到的编译错误问题,具体表现为找不到WProgram.h文件。作者发现这一问题后,通过将WProgram.h替换为Arduino.h成功解决了编译不通过的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

刚才使用自己以前编写的一个库文件,总是编译不通过,在0021上就没有问题。仔细看了看这个问题,发现原因是Arduino 1.0的版本里面没有了WProgram.h文件。

我找到的解决办法是把文件中的WProgram.h替换为Arduino.h

 

这个问题真心是坑爹,困扰好久.官网上居然也不给解释!!!





转自: http://elitezhe.sinaapp.com/wprogram-loss/ | Elitecho

/**************************************************************************/ /*! @file MQ135.h @author G.Krocker (Mad Frog Labs) @license GNU GPLv3 First version of an Arduino Library for the MQ135 gas sensor TODO: Review the correction factor calculation. This currently relies on the datasheet but the information there seems to be wrong. @section HISTORY v1.0 - First release */ /**************************************************************************/ #ifndef MQ135_H #define MQ135_H #if ARDUINO >= 100 #include "Arduino.h" #else #include "WProgram.h" #endif /// The load resistance on the board #define RLOAD 10.0 /// Calibration resistance at atmospheric CO2 level #define RZERO 76.63 /// Parameters for calculating ppm of CO2 from sensor resistance #define PARA 116.6020682 #define PARB 2.769034857 /// Parameters to model temperature and humidity dependence #define CORA 0.00035 #define CORB 0.02718 #define CORC 1.39538 #define CORD 0.0018 /// Atmospheric CO2 level for calibration purposes #define ATMOCO2 397.13 class MQ135 { private: uint8_t _pin; public: MQ135(uint8_t pin); float getCorrectionFactor(float t, float h); float getResistance(); float getCorrectedResistance(float t, float h); float getPPM(); float getCorrectedPPM(float t, float h); float getRZero(); float getCorrectedRZero(float t, float h); }; #endif /**************************************************************************/ /*! @file MQ135.cpp @author G.Krocker (Mad Frog Labs) @license GNU GPLv3 First version of an Arduino Library for the MQ135 gas sensor TODO: Review the correction factor calculation. This currently relies on the datasheet but the information there seems to be wrong. @section HISTORY v1.0 - First release */ /**************************************************************************/ #include "MQ135.h" /**************************************************************************/ /*!@brief Default constructor@param[in] pin The 将这个转化stm32
03-09
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值