I look around the forum and i saw some posts talking about making a makey makey with an arduino leonardo.
The first guide i saw was this code. I think this is so sofisticated for me. The code is in this web http://hardware-hackingmx.com/2014/01/09/arduino-makey-makey/
Here is the protoboard I did: http://hardwarehackingmx.files.wordpress.com/2014/01/makeymakey.png
I did the protoboard but i dont understood anything (Im a totally noob at arduino). Then I saw this alter makey makey leonardo code for keyboard.press - Programming Questions - Arduino Forum.
That post has this code
#include <MovingAvarageFilter.h>
MovingAvarageFilter movingAvarageFilter1(20);
MovingAvarageFilter movingAvarageFilter2(20);
boolean check1 = false;
boolean check2 = false;
void setup() {
Serial.begin(115200);
}
void loop() {
float output1 = movingAvarageFilter1.process(analogRead(0));
float output2 = movingAvarageFilter2.process(analogRead(1));
if (output1 < 200 ) { // you can change this parameter to fine tune the sensitivity
if (!check1){
Keyboard.print("d");
Serial.println(output1);
check1 = !check1;
}
}
if (output1 >600) {
if (check1){
check1 = !check1;
}
}
if (output2 < 590 ) { // you can change this parameter to fine tune the sensitivity
if (!check2){
Keyboard.print("s");
Serial.println(output2);
check2 = !check2;
}
}
if (output2 >600) {
if (check2){
check2 = !check2;
}
}
}
First question, where is void setup ? I thought that every code has to have it. Is this code right ?
At the beginning of the void loop I can see that declares 2 outputs. I'd like to have 5 key press, so had i to declare 5 outputs and repeat the if bucle with every key ?. My last question about this project is how to setup the protoboard. In the first guide I had to put some resistors. I dunno how is exactly is working the last code. I think that it detects when you close the circuit with an analog input. Am I right ? in that case, i have to close the circuit with the 5v outut, 3.3V output or GND ?
I want to do another project with my leonardo but i had an issue. I want to key press a combination of keys at the same time. For example Start key + R. I dunno how to do it
Sorry for the post but i need help to understand the code, i'm getting afraid of try codes for myself because when i upload the BIG code, i play with it . When I finished I disconect the protoboard and the board detects keypress so i was not be able to re-upload new code because the port was busy (Sending ramdom key presses to my computer).
Thanks for the support, I'ld be very gratefull with any support.
PD: I know that I have to put 's' not "s".