Go Down

Topic: Make Arduino execute commands on computer? (Read 15187 times) previous topic - next topic


If you only have 1 switch plugged in then it is probably best to remove the other buttons from the code completely



I've heard of pull-down resistors!
That sounds like it might be it. I'm going to try it right now.


Jan 17, 2009, 03:00 am Last Edit: Jan 17, 2009, 03:09 am by gnu_linux Reason: 1

Yes, I think you do indeed need pull-down resistors on your input pins if there is nothing else connected to them, otherwise they will float to HIGH when they shouldn't



Jan 17, 2009, 04:12 pm Last Edit: Jan 17, 2009, 04:13 pm by computer_freak_8 Reason: 1
Yes, it solved the problem! Thanks so much for all your help.

For anyone else it may help, the schematics that I found were here, and the code I ended up with was:
Code: [Select]
*  Trial sketch for handling button presses (converting to serial output)

int button4 = LOW;
int button5 = LOW;
int button6 = LOW;

void setup()
 pinMode(4, INPUT);
 pinMode(5, INPUT);
 pinMode(6, INPUT);

void loop()
 button4 = LOW;
 button5 = LOW;
 button6 = LOW;
 button4 = digitalRead(4);
 button5 = digitalRead(5);
 button6 = digitalRead(6);
 if (button4 == HIGH) {Serial.print("4");}
 if (button5 == HIGH) {Serial.print("5");}
 if (button6 == HIGH) {Serial.print("6");}

Note: When I tested it, I didn't have some of the code shown above, since I only had one button.

Now I can move on to my next step: using Perl to run commands on the Arduino - but that's for another thread!


hi guys

i have arduino board, arduino and max msp installed i all so have 20 leds, but i am totally lost is there anyway i can get these working with some coding, what type of coding do i need does any have any basic codes and step they can guide me through. i am really short for time.

many thanks


What exactly are you trying to do? And when you say you have "max msp" installed, are you referring to this? If so, I'm not sure how that relates to the Arduino... Do you have the Arduino software installed? Which board do you have?

Remember, to get the best help, you need to be as specific as possible.
Also, it may be best to start your own thread, with an appropriate description. That is, at least if you're not trying to get the Arduino to execute commands on your computer.

Go Up