Hi, I'm currently working on a teensy based (game)controller, but i have some problems:
My projects just keeps spitting out random letters forever, whenever i push a button (the point is it should spit out one specific letter at a time).
I have tested my circut pretty well, and can't seem to find my flaw in there, but would you maybe take a look at me (relatively short) to see if the mistake is in there? int pins[] = {0, 1, 2, 3};int vals[] = {0, 0, 0, 0};int lastVals[] = {0, 0, - Pastebin.com
or could multiple wires close together interfere with each other (sorry, i'm not a smart man..)
void setup() {
for(int i = 0; i < 4; i++)
{
pinMode(pins[i], INPUT);
digitalWrite(pins[i], HIGH);
}
}
The digialWrite enables a pull up resistor on the input. Without it the pin will be floating around picking up the local radio station or the neighbor's microwave oven.
fungus:
The digialWrite enables a pull up resistor on the input. Without it the pin will be floating around picking up the local radio station or the neighbor's microwave oven.
I'm already using a pull-down resistor, so there shouldn't be any problem there.
When you say random letters, I take that to mean you're getting lots of output outside of the 4 values in the array which gave me an idea. Does having Keyboard.begin();in setup() make a difference? I don't have a Teensy nor Leonardo to test this with, so I created a small sketch that calls Serial.print without a Serial.begin call and found it compiled but didn't produce output either.
Stabbing blindly in the dark and hoping for the best,
Geoff