This commit is contained in:
LiHuashen
2018-12-26 14:42:46 +08:00
parent 4ce02ea7f9
commit 777c3a97ce
2 changed files with 29 additions and 5 deletions
+28 -3
View File
@@ -24,9 +24,34 @@ The Unit BUTTON is a sigle-button unit that can be detected whether the button p
## Example
```arduino
float tmp = dht12.readTemperature();//temperature
float hum = dht12.readHumidity();//humidity
float pressure = bme.readPressure();//pressure
#include <M5Stack.h>
void setup() {
// init lcd
M5.begin();
pinMode(36, INPUT);
M5.Lcd.clear(BLACK);
M5.Lcd.setTextColor(YELLOW);
M5.Lcd.setTextSize(2);
M5.Lcd.setCursor(65, 10);
M5.Lcd.println("Button example");
M5.Lcd.setTextColor(RED);
}
void loop() {
M5.update();
if(digitalRead(36)==0)
{
while(1)
{
if(digitalRead(36)==1)
{
M5.Lcd.print("1");
break;
}
}
}
}
```
Click [here](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/BUTTON/Arduino)for Specific example.
+1 -2
View File
@@ -88,8 +88,7 @@
<!-- [![M5GO_Unit_rgb.png](https://i.loli.net/2018/12/13/5c121f5c98542.png)](zh_CN/unit/rgb)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_relay.png](https://i.loli.net/2018/12/13/5c121f6e9a185.png)](zh_CN/unit/relay)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![M5GO_Unit_neopixel.png](https://i.loli.net/2018/12/13/5c121f8457fcb.png)](zh_CN/unit/neopixel) -->
[![unit_hub.png](https://img-blog.csdnimg.cn/20181211174142806.png)](zh_CN/unit/hub)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![unit_3.96.png](https://img-blog.csdnimg.cn/20181211174154240.png)](zh_CN/unit/396port)
[![unit_proto.png](https://img-blog.csdnimg.cn/20181211175313832.png)](zh_CN/unit/proto)
[![unit_hub.png](https://img-blog.csdnimg.cn/20181211174142806.png)](zh_CN/unit/hub)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![unit_396port.png](https://img-blog.csdnimg.cn/20181211174154240.png)](zh_CN/unit/396port)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![unit_proto.png](https://img-blog.csdnimg.cn/20181211175313832.png)](zh_CN/unit/proto)
<!-- [![unit_hub.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/docs/assets/img/product_pics/pictures_for_homepage/units/unit_hub.png)](zh_CN/unit/hub)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[![unit_3.96.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/docs/assets/img/product_pics/pictures_for_homepage/units/unit_396port.png)](zh_CN/unit/396port)
[![unit_proto.png](http://m5-docs.oss-cn-shenzhen.aliyuncs.com/docs/assets/img/product_pics/pictures_for_homepage/units/unit_proto.png)](zh_CN/unit/proto) -->