Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Syntax & Programs / Re: Serial.println problem on: June 16, 2008, 01:18:08 pm

I re-read the serial.available function doc again, and now I realize this is a self inflicted wound.  :smiley

Serial is deceptively easy, but attention to details is required.

i think I can begin to realize how flexible the serial interface is, and how nice it would be if more devices had this interface.  

Thanks for the help!
2  Forum 2005-2010 (read only) / Syntax & Programs / Re: Serial.println problem on: June 16, 2008, 10:28:48 am

I will mess with the serial.available function as you indicate when I get home.

But remember, the pgm works perfectly until I remove the one println.

I just don't understand how a serial.println removal affects a subsequent

On the bright side, this serial stuff has been fun.

Best Regards.

3  Forum 2005-2010 (read only) / Syntax & Programs / Serial.println problem on: June 16, 2008, 04:18:54 am
In case its not obvious, this pgm should listen on the serial line, and light up three led's based on commands.

It works fine if I leave this line in:
Serial.println("w command");

If I remove it or comment it out, these variables get set to junk as the print statements confirm:

Why does this happen?

I am sure it is a newbie problem, and any help appreciated.

complete pgm follows:
// LED's connected from pin through resistors to GND, as indicated
#define RED 10
#define YELLOW 11
#define GREEN 9

void setup(){
  pinMode(RED, OUTPUT);
  pinMode(YELLOW, OUTPUT);
  pinMode(GREEN, OUTPUT);  

void loop(){
  char cmd1,cmd2,cmd3;
  while (Serial.available()>0){
    cmd1 =;
      Serial.println("w command");;;
      if((cmd2=='y')&&(cmd3=='1')) digitalWrite(YELLOW,HIGH);
      if((cmd2=='y')&&(cmd3=='0')) digitalWrite(YELLOW,LOW);
      if((cmd2=='g')&&(cmd3=='1')) digitalWrite(GREEN,HIGH);
      if((cmd2=='g')&&(cmd3=='0')) digitalWrite(GREEN,LOW);
      if((cmd2=='r')&&(cmd3=='1')) digitalWrite(RED,HIGH);
      if((cmd2=='r')&&(cmd3=='0')) digitalWrite(RED,LOW);
      if(cmd2=='0'){digitalWrite(YELLOW, LOW); digitalWrite(GREEN, LOW); digitalWrite(RED, LOW);}
      if(cmd2=='1'){digitalWrite(YELLOW, HIGH); digitalWrite(GREEN, HIGH); digitalWrite(RED, HIGH);}

4  Forum 2005-2010 (read only) / Troubleshooting / Re: Diecimila troubles on: June 20, 2008, 04:30:13 pm

Try this for grins:
Device Manager - Comm Ports - USB Serial Port -Port Settings - Advanced button - Set RTS On Close  

There is a litany of problems with the FTDI serial interface so don't feel like you are unique. Hang in there, it will be worth it.  smiley

5  Forum 2005-2010 (read only) / Bar Sport / Re: "Processing" from on: June 16, 2008, 06:51:10 pm
ok guys. Thanks. I think I got it.
6  Forum 2005-2010 (read only) / Bar Sport / Re: "Processing" from on: June 16, 2008, 05:47:10 pm
Melka, thanks for the info.

Let me see if I understand...

So basically,
Arduino environment = Just programs Arduino hardware, provides a serial terminal.
Processing = simplified Java (that some people use to communicate with Arduino hardware?)

I don't know much about Java but if I wanted to spend time on OO, I think C++ would be more appropriate. Personal Opinion of course!

Take it easy.

7  Forum 2005-2010 (read only) / Bar Sport / "Processing" from on: June 16, 2008, 03:29:23 pm
Can I install processing and have it co-exist without hassle on the same pc as the Arduino software?

I realize that when dealing with the serial port, only one program can have it.

My understanding of Processing, is that it has more of graphics front end to, let's say, the Arduino, than the Arduino IDE is, right? I mean, the Arduino IDE is more about writing C, than anything else. Could someone familiar with both pls expound on this!

Also, I went to the wiring forum and found relatively little activity. The processing forum activity is more like here. (Just rambling, random notes here.)

Pages: [1]