Poll
Question: arduino max msp help help
max msp, codeing - 0 (0%)
max msp led light code - 0 (0%)
Total Voters: 0

Pages: 1 2 [3]   Go Down
Author Topic: Make Arduino execute commands on computer?  (Read 5694 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 430
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

smiley
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 42
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 430
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://en.wikipedia.org/wiki/Pull-down_resistor

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

smiley
« Last Edit: January 16, 2009, 09:09:25 pm by gnu_linux » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 42
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
/*
*
*  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);
  Serial.begin(9600);
}

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");}
  
  delay(300);
}
 

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!
« Last Edit: January 17, 2009, 10:13:34 am by computer_freak_8 » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 42
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@lostworld:
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.
Logged

Pages: 1 2 [3]   Go Up
Jump to: