Pages: [1]   Go Down
Author Topic: [Solved]Loop Refference page  (Read 1401 times)
0 Members and 1 Guest are viewing this topic.
Maine
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
You blocked me on facebook and now youre going to die!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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?
« Last Edit: October 26, 2012, 11:03:54 am by conradin » Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, spotted the error:

beginSerial(9600);

should be:

Serial.begin(9600);

And

serialWrite()

should be

Serial.write()
Logged

Maine
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
You blocked me on facebook and now youre going to die!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.  smiley
Logged

Maine
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
You blocked me on facebook and now youre going to die!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
Milano, Italy
Offline Offline
Edison Member
*****
Karma: 19
Posts: 1175
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

F

Pages: [1]   Go Up
Jump to: