Go Down

Topic: Serial problems (Read 499 times) previous topic - next topic

RonaldB

Hello,
I think i have a serial command problem over the TX pin.

When I use this Sketch and I press the button I get really strange outputs on my serial screan.

Quote
/*
* Button
* by DojoDave <http://www.0j0.org>
*
* Turns on and off a light emitting diode(LED) connected to digital  
* pin 13, when pressing a pushbutton attached to pin 7.
*
* http://www.arduino.cc/en/Tutorial/Button
*/

int ledPin = 13;                // choose the pin for the LED
int inputPin = 2;               // choose the input pin (for a pushbutton)
int val = 0;                    // variable for reading the pin status

void setup() {
 pinMode(ledPin, OUTPUT);      // declare LED as output
 digitalWrite(inputPin, HIGH);
 pinMode(inputPin, INPUT);     // declare pushbutton as input
 Serial.begin(9600);
}

void loop(){
 val = digitalRead(inputPin);  // read input value
 if (val == LOW) {            // check if the input is HIGH
   digitalWrite(ledPin, LOW);  // turn LED OFF
   Serial.println("test");
 } else {
   digitalWrite(ledPin, HIGH); // turn LED ON
 }
}


Quote
¼?b??b?îb??b??????"??b¿?b¼?b??b?îb??b????b??b¾?b??b?ïb??b??
??b¤?b?÷1¿åb??b??????b??b´?b?îb?åb??1¿???b¾?b??b?ïb??b??
????b¼?b??b?íb??      ??b??b´?b?îb?Åb??????b¿?b??b??b?åb??
??b??b¼?b¤?b?ïb?íb?Åb??1¿?
??b??b¼?b??b??????b¿?b¼?b??b??b?ïb?åb??
??b??b´?b??b?îb?åb??b????b??b¾?b¤?b??b?åb??1¿???b¾?b??b?åb??1¿?
??b??b¼?b??b?íb????b??b¾?b´?b??b?ïb??1¿?"??b¿?b´?b??b?ïb?Åb??b??????b¿?b¼?b??      ????b¿?b??b?íb?Åb??
??
??b??b´?b?îb?åb??b??      ????b¿?b´?b


What's the problem here.

Thanks in advance.

RonaldB

RonaldB

Sorry it works, I burned a Lilypad code on a Diecimila board  :(

anachrocomputer

I was just going to suggest that it's a baud rate problem, but you've confirmed it.  The different clock speeds of the two boards would account for the behaviour in the serial monitor.

Go Up