1602 LCD 显示
这个浇花系统计划加上LCD显示,比如当前湿度等等
使用Intel Edison以及Grove Starter Kit附带的RGB Backlight LCD来实现这个非常简单
打开:Sketchbook_Starter_Kit_V2.0-master\Grove_RGB_Backlight_LCD
发现里边有各种示例
以下是Hello World的示例
/*
Hello World.ino
2013 Copyright (c) Seeed Technology Inc. All right reserved.
Author:Loovee
2013-9-18
Grove - Serial LCD RGB Backlight demo.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <Wire.h>
#include "rgb_lcd.h"
rgb_lcd lcd;
const int colorR = 0;
const int colorG = 0XFF;
const int colorB = 0;
void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.setRGB(colorR, colorG, colorB);
// Print a message to the LCD.
lcd.print("hello, world!");
delay(1000);
}
void loop()
{
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
delay(100);
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/
除了显示以外,我们需要读取湿度传感器的数据
这个很简单,就是通过模拟口读回数值进行判断
可以用电位器模拟,代码如下:
// Demo for Grove - Starter Kit V2.0
// Prints the value of the potentiometer to the serial console.
// Connect the Grove - Rotary Angle Sensor to the socket marked A0
// Open the Serial Monitor in the Arduino IDE after uploading
// Define the pin to which the angle sensor is connected.
const int potentiometer = A0;
void setup()
{
// Configure the serial communication line at 9600 baud (bits per second.)
Serial.begin(9600);
// Configure the angle sensor's pin for input.
pinMode(potentiometer, INPUT);
}
void loop()
{
// Read the value of the sensor and print it to the serial console.
int value = analogRead(potentiometer);
Serial.println(value);
// Wait 0.1 seconds between readings.
delay(100);
}
回复
| 有奖活动 | |
|---|---|
| 2026年“我要开发板活动”第三季,开始了! | |
| 硬核工程师专属补给计划——填盲盒 | |
| “我踩过的那些坑”主题活动——第002期 | |
| 【EEPW电子工程师创研计划】技术变现通道已开启~ | |
| 发原创文章 【每月瓜分千元赏金 凭实力攒钱买好礼~】 | |
| 【EEPW在线】E起听工程师的声音! | |
| 高校联络员开始招募啦!有惊喜!! | |
| 打赏了!打赏了!打赏了! | |
我要赚赏金打赏帖 |
|
|---|---|
| 空气质量检测器设计与实现被打赏¥24元 | |
| 【瑞萨RA8D1 LVGL/LWIP评测】LWIP进行UDP、TCP、HTTP、MQTT功能联合测试被打赏¥41元 | |
| 【瑞萨RA8D1 LVGL/LWIP评测】RA8D1部署FreeRTOS+LWIP被打赏¥36元 | |
| RTOS怎么选?让我来给你答案!被打赏¥15元 | |
| 【S32K3XX】Flash驱动使用被打赏¥26元 | |
| 【FreeRtos】第一个任务的启动过程被打赏¥21元 | |
| 【分享开发笔记,赚取电动螺丝刀】FPB-RA6E2开发板的WDT功能测试被打赏¥22元 | |
| 关于cmakelist特性presets的使用被打赏¥20元 | |
| 【分享开发笔记,赚取电动螺丝刀】M5STACK系列屏幕质量测试程序,竟然有块亮斑?被打赏¥20元 | |
| 【分享开发笔记,赚取电动螺丝刀】快速搭建瑞萨FPB-RA6E2开发板开发环境被打赏¥14元 | |
我要赚赏金
