新手ARDUINO 电容感应钢琴制作((求救
第一次摸这个东西。然后跟了2个教程实验了无数次都没有成功。。。。不知道是我做错了什么吗?
教程1:
arduino 制作的纸钢琴\ 梨木·乔
教程2:
youtube里面一个视频:
Arduino- 電容感應音樂樹
里面分享的教程
然后喇叭是怎么链接的。。。为什么我跟教程把+连去pin10 然后把-连接去GND 就完全没有声音,然后把+换去连接pin1时就有固定的响声。但是我触摸自己做的琴键时都没有反应。。。
有没有做过这个项目的人来帮忙我一下。完全不知道问题出哪里了。。。(电路连接错吗?怎么连接好((第一次摸这个东西。。。
代码编程我是直接拿link 1 里面的了。代码不知道有没有问题。。。。 沒看到你發出的 link。
youtube 的 link? 是這個嗎?
https://www.youtube.com/watch?v=HS5vrHllELg 你所說的 教程1,是這個嗎?
http://limuqiao.com/2017/10/25/Arduino-en-paper-piano/ 本帖最后由 eddiewwm 于 2019-9-6 11:21 编辑
喇叭接在 Pin_11 和 GND
程序:
// Import the CapacitiveSensor Library.
#include <CapacitiveSensor.h>
#define speaker 11
// Set the Send Pin & Receive Pin.
CapacitiveSensor cs_2_3 = CapacitiveSensor(2,3);
CapacitiveSensor cs_2_4 = CapacitiveSensor(2,4);
CapacitiveSensor cs_2_5 = CapacitiveSensor(2,5);
CapacitiveSensor cs_2_6 = CapacitiveSensor(2,6);
CapacitiveSensor cs_2_7 = CapacitiveSensor(2,7);
CapacitiveSensor cs_2_8 = CapacitiveSensor(2,8);
CapacitiveSensor cs_2_9 = CapacitiveSensor(2,9);
CapacitiveSensor cs_2_10 = CapacitiveSensor(2,10);
void setup()
{
cs_2_6.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example
// Arduino start communicate with computer.
Serial.begin(9600);
}
void loop()
{
// Set a timer.
long start = millis();
// Set the sensitivity of the sensors.
long total1 =cs_2_3.capacitiveSensor(3000);
long total2 =cs_2_4.capacitiveSensor(3000);
long total3 =cs_2_5.capacitiveSensor(3000);
long total4 =cs_2_6.capacitiveSensor(3000);
long total5 =cs_2_7.capacitiveSensor(3000);
long total6 =cs_2_8.capacitiveSensor(3000);
long total7 =cs_2_9.capacitiveSensor(3000);
long total8 =cs_2_10.capacitiveSensor(3000);
Serial.print(millis() - start); // check on performance in milliseconds
Serial.print("\t"); // tab character for debug windown spacing
Serial.print(total1); // print sensor output 1
Serial.print("\t"); // Leave some space before print the next output
Serial.print(total2); // print sensor output 2
Serial.print("\t"); // Leave some space before print the next output
Serial.print(total3); // print sensor output 3
Serial.print("\t"); // Leave some space before print the next output
Serial.print(total4); // print sensor output 4
Serial.print("\t"); // Leave some space before print the next output
Serial.print(total5); // print sensor output 5
Serial.print("\t"); // Leave some space before print the next output
Serial.print(total6); // print sensor output 6
Serial.print("\t"); // Leave some space before print the next output
Serial.print(total7); // print sensor output 7
// Leave some space before print the next output
Serial.print("\t");
Serial.println(total8); // print sensor output 8
// "println" - "ln" represent as "line", system will jump to next line after print the output.
// When hand is touched the sensor, the speaker will produce a tone.
// I set a threshold for it, so that the sensor won't be too sensitive.
if (total1 > 500) tone(speaker,131); // frequency
if (total2 > 500) tone(speaker,147); // you can see https://www.arduino.cc/en/Tutorial/toneMelody if you want to change frequency
if (total3 > 500) tone(speaker,165);
if (total4 > 500) tone(speaker,175);
if (total5 > 500) tone(speaker,196);
if (total6 > 500) tone(speaker,220);
if (total7 > 500) tone(speaker,247);
if (total8 > 500) tone(speaker,262);
// When hand didn't touch on it, no tone is produced.
if (total1<=500&total2<=500&total3<=500 & total4<=500&total5<=500&total6<=500 &total7<=500 &total8<=500)
noTone(speaker);
delay(10); // arbitrary delay to limit data to serial port
} eddiewwm 发表于 2019-9-6 10:22
沒看到你發出的 link。
youtube 的 link?
是的。是那2个,但是我怎么做都不成功。
喇叭我换成0.5w的了。link我分享不到。。因为我按发布的时候他说我没有权限发布link... DREAMY123 发表于 2019-9-6 16:49
是的。是那2个,但是我怎么做都不成功。
喇叭我换成0.5w的了。link我分享不到。。因为我按发布的时候他说 ...
注意 喇叭 接往 Pin_11 和 GND 刚刚尝试了。一样不能。是不是电阻的关系?(电阻我用1m,会再去买2. 2m)还是我板子有问题。。。想去买个try看看。 DREAMY123 发表于 2019-9-6 17:57
刚刚尝试了。一样不能。是不是电阻的关系?(电阻我用1m,会再去买2. 2m)还是我板子有问题。。。想去买个tr ...
你先試一路,把兩個1M 串地起來用就可以得到 2M,不要急著買零件 我尝试做了一个键。依旧没有反应。 DREAMY123 发表于 2019-9-6 20:03
我尝试做了一个键。依旧没有反应。
接線位置改一下看看
有点像 makeymakey:lol eddiewwm 发表于 2019-9-9 12:00
接線位置改一下看看
我做到了,但是不灵敏。代码改了灵敏度。。。但是怎么调都达不到碰了他就马上有反应要摸上大概30多秒吧。
调太灵敏他有时无缘无故的响。然后代码那边我没有用上面的了。找新的然后改了一点(不然speaker 响不停。。。要加no tone
再来就是声音不稳定。。。他不会跟着编码的声音走常常是一个音罢了。
页:
[1]