Go Down

Topic: [Solved]Loop Refference page (Read 1 time) previous topic - next topic

conradin

Oct 23, 2012, 05:33 am Last Edit: Oct 26, 2012, 06:03 pm by conradin Reason: 1
Hi all,
I was just on the Loop reference page:
http://arduino.cc/en/Reference/Loop
When I tried the code example, I found the code wouldn't compile!
So I changed the code to this an it works!
Maybe someone should change that page to a working example?
Code: [Select]
int buttonPin = 3;

// setup initializes serial and the button pin
void setup()
{
 Serial.begin(9600);
 pinMode(buttonPin, INPUT);
}

// loop checks the button pin each time,
// and will send serial if it is pressed
void loop()
{
 if (digitalRead(buttonPin) == HIGH)
   Serial.write('H');
 else
   Serial.write('L');

 delay(1000);
}



I am in version 1.0.1 of Arduino, with an UNO board if that matters.
Perhaps the reference page is an old example?

tuxduino

Please post the exact error messages you see (remember to enable verbose compiling).

tuxduino

Sorry, spotted the error:

beginSerial(9600);

should be:

Serial.begin(9600);

And

serialWrite()

should be

Serial.write()

conradin

Ah, Yeah, Sorry.
I know whats wrong with it already. I'm just posting for a fix to the site example, because having working examples is important to me. Is there a better means to do this? Is the forum related to the website in such a way that this example might get fixed?

tuxduino

Playground pages can be edited by registered users. Don't know about reference pages. I guess not... But hopefully some site admin will notice this thread and fix that page.  :)

conradin

I just realized that the pages on http://arduino.cc/en/Reference/HomePage
are inluded in the source package under: arduino/reference. Except HomePage is index.html.
I checked, and the loop example is wrong there too.
Is that a topic for the webmaster or the source code dev team?

Federico Vanzati

This is an old legacy of the first version of the Arduino language!
Fixed, thanks for noticing!
F

Go Up