Arduino example MIDI Note Player will not compile.

I get this error

sketch_oct01a.cpp: In function 'void loop()':
sketch_oct01a:31: error: 'intnote' was not declared in this scope
sketch_oct01a:31: error: 'note' was not declared in this scope

probably you forgot a space between int and note…

I did not forget anything, because this is how it is written on the example page - I just copy/paste. For a beginner, this is utterly confusing and I hope this gets corrected.

/*
 MIDI note player
 
 This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data.
 If this circuit is connected to a MIDI synth, it will play 
 the notes F#-0 (0x1E) to F#-5 (0x5A) in sequence.

 
 The circuit:
 * digital in 1 connected to MIDI jack pin 5
 * MIDI jack pin 2 connected to ground
 * MIDI jack pin 4 connected to +5V through 220-ohm resistor
 Attach a MIDI cable to the jack, then to a MIDI synth, and play music.

 created 13 Jun 2006
 modified 2 Jul 2009
 by Tom Igoe 

 This example code is in the public domain.
 
 http://www.arduino.cc/en/Tutorial/MIDI
 
 */

void setup() {
  //  Set MIDI baud rate:
  Serial.begin(31250);
}

void loop() {
  // play notes from F#-0 (0x1E) to F#-5 (0x5A):
  for (intnote = 0x1E; note < 0x5A; note ++) {
    //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
    noteOn(0x90, note, 0x45);
    delay(100);
    //Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
    noteOn(0x90, note, 0x00);   
    delay(100);
  }
}

//  plays a MIDI note.  Doesn't check to see that
//  cmd is greater than 127, or that data values are  less than 127:
void noteOn(int cmd, int pitch, int velocity) {
  Serial.print(cmd, BYTE);
  Serial.print(pitch, BYTE);
  Serial.print(velocity, BYTE);
}

Hi vanakaru, as David so kindly points out, given just the error messages, is that it seems likely that a typing error (yours, the webpage, whereever) has omitted the space between the word int and the word note some where in the code. That is a good guess, because if it said “int note” that would define the variable “note” and thus elliminate both errors (defining the right names)

And - voila - your 2nd post shoing the code clear shows this.

for (intnote = 0x1E; note < 0x5A; note ++) {

should be

for (int note = 0x1E; note < 0x5A; note ++) {

Yes. That is all so dandy. But on the example page http://arduino.cc/en/Tutorial/Midi there is no space between int and note.

WOW, two weeks and the sample code is not corrected still.

WOW, two weeks and the sample code is not corrected still.

You're not waiting for someone else to add the space for you, are you?

What he is meaning, that noone is correcting the samplecode on the arduino.cc Tutorial site, leading more people into this problem.