当前位置: 首页 > news >正文

南充网站建设略奥网络运营一个网站一年费用

南充网站建设略奥网络,运营一个网站一年费用,国内网络科技网站建设,软件开发定制目录 概述 1 硬件结构 1.1 整体硬件介绍 1.2 硬件连接结构 2 软件设计 2.1 软件功能介绍 2.2 关于Arduino的一些知识点 2.2.1 定时器 2.2.2 PWM 2.3 代码实现 2.3.1 编译工具 2.3.2 详细代码 3 测试 3.1 温度数据监控 3.2 温控测试 概述 本文介绍如何使用Ardui…目录 概述 1 硬件结构 1.1 整体硬件介绍 1.2 硬件连接结构 2 软件设计 2.1 软件功能介绍 2.2 关于Arduino的一些知识点 2.2.1 定时器  2.2.2 PWM 2.3 代码实现 2.3.1 编译工具 2.3.2 详细代码 3 测试 3.1 温度数据监控 3.2 温控测试 概述 本文介绍如何使用Arduino UNO作为主控制板设计一个智能温控系统其实现功能如下当环境温度达到一定的门限值时开始风扇当环境温度低于该门限值则关闭风扇。系统使用DS18B20采集环境温度L298N驱动电机OLED显示当前环境温度。软件设计上使用Arduino自带的定时器中断功能用于控制时间间隔。还使用了PWM技术以控制电机的转速。 1 硬件结构 1.1 整体硬件介绍 1Arduino UNO 主控板卡 2控制L298N用于控制电机系统 3控制OLED模块用于显示当前温度数据 4控制DS18B20获取环境温度数据 5直流电机驱动扇叶 1.2 硬件连接结构 模块引脚与Arduino UNO主板之间关系 Arduino UNO  IO应用模块IO注释PIN-2DS18B20 DQPIN-5L298N in-1用于电机控制PIN-6L298N in-2用于电机控制SCLOLED-sclSDAOLED-sda 2 软件设计 2.1 软件功能介绍 软件主要实现功能如下 1 控制DS18B20读取该传感器采集到的温度值 2 在OLED显示温度数据 3通过串口打印调试信息 4根据门限值控制电机转速(PWM) 2.2 关于Arduino的一些知识点 2.2.1 定时器  在Arduino中使用定时器必须要包含该头文件 MsTimer2.h然后调用如下函数启动定时器并且还要实现一个中断回调函数。 void startTime() {// 中断设置函数每 500ms 进入一次中断MsTimer2::set(500, timer_irq);//开始计时MsTimer2::start(); }//回调函数 void timer_irq() {} 2.2.2 PWM 在Arduino UNO板卡中使用PWM功能其能使用的引脚为pin( 3, 5, 6, 9, 10, 11)使用方法如下 1 配置端口为模拟引脚 2使用analogWrite( pin, cycle )函数来配置占空比参数含义如下 pin - 引脚号 cycle - 占空比范围 0 ~ 255 一个使用案例 //for motor port const int output1 5; const int output2 6; // 初始化IOvoid setup() {pinMode(output1, OUTPUT); pinMode(output2, OUTPUT); }// 配置占空比void pwmCycle() {analogWrite(output1, 150); analogWrite(output2, 0); } 2.3 代码实现 2.3.1 编译工具 2.3.2 详细代码 /* Copyright 2024-2029. All rights reserved. 文件名 : motorCtrl 作者 : tangmingfei2013126.com 版本 : V1.0 描述 : 自动温控系统 其他 : 无 日志 : 初版V1.0 2024/2/15 */ #include MsTimer2.h #include OneWire.h #include DallasTemperature.h #include Adafruit_GFX.h #include Adafruit_SSD1306.h#define ONE_WIRE_BUS 2// for ds18b20 port OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(oneWire);//for motor port const int output1 5; const int output2 6; // for SSD1306 #define OLED_RESET 4 Adafruit_SSD1306 display(OLED_RESET);unsigned int cnt 0; int pwmcycle 0;void timer_irq();void setup() {Serial.begin(9600);// put your setup code here, to run once:pinMode(output1, OUTPUT); pinMode(output2, OUTPUT); analogWrite(output1, 0); analogWrite(output2, 0); // by default, well generate the high voltage from the 3.3v line internally! (neat!)display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)display.display();// Show the display buffer on the hardware.// NOTE: You _must_ call display after making any drawing commands// to make them visible on the display hardware! display.clearDisplay();// 中断设置函数每 500ms 进入一次中断MsTimer2::set(500, timer_irq);//开始计时MsTimer2::start(); }void loop() {int tempPwmCycle 0;// put your main code here, to run repeatedly:if( cnt%2 0 ){sensors.requestTemperatures(); // 发送命令获取温度if( cnt%3 0 ){display.clearDisplay();Serial.print(Temperature for the device 1 (index 0) is: );Serial.println(sensors.getTempCByIndex(0)); display.setTextSize(1); display.setCursor(0,0); // Start at top-left cornerdisplay.println(F(Current temp: ));display.setTextSize(2); // Normal 1:1 pixel scaledisplay.setTextColor(SSD1306_WHITE); // Draw white textdisplay.setCursor(25,15); // Start at top-left cornerdisplay.println(sensors.getTempCByIndex(0));display.display();}}if( sensors.getTempCByIndex(0) 20 ){tempPwmCycle 100;}else{tempPwmCycle 0;}if( pwmcycle ! tempPwmCycle ){pwmcycle tempPwmCycle;analogWrite(output1, pwmcycle); analogWrite(output2, 0); } }void timer_irq() { cnt; }3 测试 3.1 温度数据监控 采集和打印温度数据信息 3.2 温控测试 温度值 Value 20 ℃ 开启风扇
http://www.pierceye.com/news/845448/

相关文章:

  • 西安网站品牌建设福州建设发展集团网站
  • 网站源码怎么有wordpress内嵌播放器
  • 南宁网站快速排名提升一起来做网站17
  • 网站做数据分析什么软件是做网站的
  • 邯郸移动网站建设建设网站的报价
  • 做网站优化期间能收到网站吗科技创新与应用
  • 有没有做的很炫的科技型网站wordpress企业主题二次开发下载
  • 陕西住房和建设部网站深圳外贸建站模版
  • 自己做网站的各种代码wordpress只能访问主页
  • 四川监理协会建设网站长沙有哪些楼盘
  • 网站首页欣赏网站模板 wordpress带会员系统
  • 关于音乐的个人网站wordpress 报名表单
  • 国内做的好看的网站设计wordpress 与现有sso
  • 通辽网站建设罗湖中心区做网站
  • 宁波网站建设哪家快湛江专业的建站托管
  • 四川省城乡住房建设部网站首页自建wordpress 客户端
  • 番禺做网站价格百度app打开
  • 扬中网站推广导流非国产手机浏览器
  • 外国网站英语要求建立网站就是制作网页
  • 电商网站建设与运营实训可以做网站的app
  • 深圳南山区网站建设公司站长工具seo综合查询 分析
  • 互粉的网站是怎么做的网站建设公司利润怎么样
  • 个人网站平台搭建咸阳企业做网站
  • 租用外国服务器网站网站建设电子商务论文选题方向
  • 网站建设那种语言好wordpress 首页添加链接
  • NET开发网站开发工程师招聘潍坊市网站建设公司
  • 自己开发网站怎么盈利开发游戏需要多少资金
  • 先域名 还是先做网站塘厦
  • 企业公众号以及网站建设wordpress 代码块样式
  • 网站源码搭建教程大同建设银行保安招聘网站