Meu objetivo era fazer um teclado simples no estilo Makey Makey (com o corpo do usuário conduzindo corrente).

A montagem da protoboard é essa:

O código utilizado no Arduino é esse:

// Includes the noise filter library available at https://github.com/sebnil/Moving-Avarage-Filter--Arduino-Library-
#include <MovingAvarageFilter.h>

MovingAvarageFilter movingAvarageFilter1(20);
MovingAvarageFilter movingAvarageFilter2(20);
MovingAvarageFilter movingAvarageFilter3(20);
MovingAvarageFilter movingAvarageFilter4(20);
boolean check1 = false;
boolean check2 = false;
boolean check3 = false;
boolean check4 = false;

void setup() {
pinMode(0, INPUT);
pinMode(1, INPUT);
pinMode(2, INPUT);
pinMode(3, INPUT);
}

void loop() {

float input1 = analogRead(0);
float output1 = movingAvarageFilter1.process(input1); //input processing to filter noise
if (output1 < 500 ) { // you can change this parameter to fine tune the sensitivity
if (!check1) {
tone(12, 440);
check1 = !check1;
}
}
if (output1 >800) { // you can change this parameter to fine tune the sensitivity
if (check1) {
noTone(12);
check1 = !check1;
}
}

float input2 = analogRead(1);
float output2 = movingAvarageFilter2.process(input2); //input processing to filter noise
if (output2 < 500 ) { // you can change this parameter to fine tune the sensitivity
if (!check2) {
tone(12, 660);
check2 = !check2;
}
}
if (output2 >800) { // you can change this parameter to fine tune the sensitivity
if (check2) {
noTone(12);
check2 = !check2;
}
}

float input3 = analogRead(2);
float output3 = movingAvarageFilter3.process(input3); //input processing to filter noise
if (output3 < 500 ) { // you can change this parameter to fine tune the sensitivity
if (!check3) {
tone(12, 880);
check3 = !check3;
}
}
if (output3 >800) { // you can change this parameter to fine tune the sensitivity
if (check3) {
noTone(12);
check3 = !check3;
}
}

float input4 = analogRead(3);
float output4 = movingAvarageFilter4.process(input4); //input processing to filter noise
if (output4 < 500 ) { // you can change this parameter to fine tune the sensitivity
if (!check4) {
tone(12, 1240);
check4 = !check4;
}
}
if (output4 >800) { // you can change this parameter to fine tune the sensitivity
if (check4) {
noTone(12);
check4 = !check4;
}
}

}

O código pode ser facilmente alterado para suportar mais inputs.

Referência: https://github.com/BhavyaShukla/Makey-makey-using-arduino-uno-r3-Mu...

Projeto feito para o curso Tinkering Fundamentals: A Constructionist Approach to STEM Learning, do Coursera (https://class.coursera.org/tinkering-001)

Exibições: 1475

Comentar

Você precisa ser um membro de Laboratorio de Garagem (arduino, eletrônica, robotica, hacking) para adicionar comentários!

Entrar em Laboratorio de Garagem (arduino, eletrônica, robotica, hacking)

Comentário de Leonardo Barichello em 26 agosto 2014 às 8:14

Luiz Henrique, já tentei fazer e não funcionou tão bem quanto esse. Mas com certeza é um projeto bacana.

Comentário de Luiz Henrique em 25 agosto 2014 às 23:52

http://loopyn.com.br/blog/qualquer-objeto-condutor-como-sensor-capa... tipo isso, parecido com oque tu fez, so que usando capacitancia

Comentário de Luiz Henrique em 25 agosto 2014 às 23:50

cara, procura sobre teclado capacitivo arduino, eh bem legal, vc pode fazer com uma folha rabiscada de grafite e não precisa segurar aquele fiozinho de terra

Comentário de wilson domingos machado em 14 agosto 2014 às 11:08

cara, muito bom este projeto 

Comentário de Helio Duarte em 3 agosto 2014 às 15:23

Muito legal!!!

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço