“吼一声试试”的版本间的差异

来自Labplus盛思维基百科
跳转至: 导航搜索
第1行: 第1行:
 +
[[文件:吼一声试试.png|300px|缩略图|右 ]]<br />
  
[[文件:吼一声试试_ico.png|400px|缩略图|右 ]]<br />
 
  
 
== 概述 ==
 
== 概述 ==
第12行: 第12行:
 
<br/>
 
<br/>
 
=== <font size=3px>组装说明</font> ===
 
=== <font size=3px>组装说明</font> ===
[[:File:XXXX装配.pdf |XXXX装配下载]]
+
[[:File:吼一声试试装配.pdf|吼一声试试装配说明下载]]
 
<br/>
 
<br/>
 
[[File:吼一声试试_装配.png]]
 
[[File:吼一声试试_装配.png]]
<br/>
 
 
<br/>
 
<br/>
  
第22行: 第21行:
 
!模块名称||数量
 
!模块名称||数量
 
|-
 
|-
|||x1
+
|W1主控板||x1
 +
|-
 +
|声音触发器||x1
 
|-
 
|-
|||x1
+
|RGB灯带(10颗)||x1
 
|}
 
|}
 
=== <font size=3px>电子模块连接说明</font>  ===
 
=== <font size=3px>电子模块连接说明</font>  ===
第33行: 第34行:
 
!  模块 !!引脚 !! 说明
 
!  模块 !!引脚 !! 说明
 
|-
 
|-
| 温度传感器模块 || W1-I2C接口||
+
| 声音触发器|| W1-A0/A1接口||
 
|-
 
|-
| RGB—LED模块x4 ||W1-3/11接口 ||
+
| RGB灯带(10颗) ||W1-2/4接口 ||
 
|-
 
|-
 
|}
 
|}
 
=== <font size=3px>Arduino程序/图形化程序</font> ===
 
=== <font size=3px>Arduino程序/图形化程序</font> ===
 
<pre style="color:blue">
 
<pre style="color:blue">
 +
#include "Adafruit_NeoPixel.h"
 +
 +
#define s 500
 +
#define SWITCHPIN      A0
 +
 +
 +
int numpixelsPin = 2;
 +
// How many NeoPixels are attached to the Arduino?
 +
#define NUMPIXELS      10
 +
 +
Adafruit_NeoPixel pixels1 = Adafruit_NeoPixel(NUMPIXELS, numpixelsPin, NEO_GRB + NEO_KHZ800);
 +
void setup() {
 +
  pinMode(numpixelsPin,OUTPUT);
 +
  digitalWrite(numpixelsPin,LOW); 
 +
  // put your setup code here, to run once:
 +
  pixels1.begin(); // This initializes the NeoPixel library.
 +
 
 +
  pinMode(SWITCHPIN,INPUT);
 +
  Serial.flush();
 +
  Serial.begin(115200);
 +
}
 +
 +
int num;
 +
int r,g,b;
 +
int led = 10;
 +
int ks;
 +
 +
void loop()
 +
{
 +
  // put your main code here, to run repeatedly:
 +
  ks=digitalRead(A0);
 +
//  ks = analogRead(A0);
 +
  Serial.println(ks);
 +
  if(ks)
 +
  {
 +
      r = random(0,255);
 +
      g = random(0,255);
 +
      b = random(0,255);
 +
      for(num = 0; num < led; num++)
 +
      {
 +
        pixels1.setPixelColor(num, pixels1.Color(r,g,b)); // Moderately bright green color.
 +
      }
 +
      pixels1.show(); // This sends the updated pixel color to the hardware
 +
     
 +
      //delay(s);
 +
      while(digitalRead(A0) != 0);
 +
      delay(200);     
 +
  }
 +
}
 
</pre>
 
</pre>
  

2018年5月29日 (二) 11:12的版本

吼一声试试.png


概述

本作品可通过声音传感器触发改变彩色RGB灯带颜色。使用时先根据制作说明将作品组装完整,然后接上电源 (9V电池或USB供电),打开主控板开关,触发声音传感器即可。本作品用声音触发器作为输入装置,彩色RGB 灯带作为输出装置,可自行编程改变颜色、变换方式、灯带数量等。DIY动手组装,锻炼动手能力,了解智能创 意电子套件的使用,激发创新思维,增加学习乐趣。

使用教程

使用说明包含程序控制流程

组装说明

吼一声试试装配说明下载
吼一声试试 装配.png

电子模块清单

模块名称 数量
W1主控板 x1
声音触发器 x1
RGB灯带(10颗) x1

电子模块连接说明

模块 引脚 说明
声音触发器 W1-A0/A1接口
RGB灯带(10颗) W1-2/4接口

Arduino程序/图形化程序

#include "Adafruit_NeoPixel.h"

#define s 500
#define SWITCHPIN      A0


int numpixelsPin = 2;
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS      10

Adafruit_NeoPixel pixels1 = Adafruit_NeoPixel(NUMPIXELS, numpixelsPin, NEO_GRB + NEO_KHZ800);
void setup() {
  pinMode(numpixelsPin,OUTPUT);
  digitalWrite(numpixelsPin,LOW);  
  // put your setup code here, to run once:
  pixels1.begin(); // This initializes the NeoPixel library.
  
  pinMode(SWITCHPIN,INPUT);
  Serial.flush(); 
  Serial.begin(115200);
}

int num;
int r,g,b;
int led = 10;
int ks;

void loop() 
{
  // put your main code here, to run repeatedly:
  ks=digitalRead(A0);
//  ks = analogRead(A0);
  Serial.println(ks);
  if(ks)
  {
      r = random(0,255);
      g = random(0,255);
      b = random(0,255);
      for(num = 0; num < led; num++) 
      {
        pixels1.setPixelColor(num, pixels1.Color(r,g,b)); // Moderately bright green color.
      }
       pixels1.show(); // This sends the updated pixel color to the hardware
       
       //delay(s);
      while(digitalRead(A0) != 0);
      delay(200);      
  }
}

FAQ

版本历史记录

Version Date 新增/删除/修复