Hello, Noob here. Getting an error message


hello all,
i pulled in code outside source.
and needed in couple of places.

error code. "expected unqualified-id before "{" token"
whey tried verify code gives me error.

the program lazer harp.
i should turn on lazer pointed @ mirror.
then tell stepper motor 'sweep' mirror , forth create 8 beams.
when break beam triggers midi note on attached keyboard/ electric synthesizer.

thank can give.
chris
here code...


code: [select]

int laserstate = low;                   // variable stores state of laser beam.
int sensor = 6;                         // change value calibrate harp's sensor
int delaylaser = 8;                     // if increase this, laser brighter, harp less fluid
int delaymotor = 20;                   // variable affects speed, , fluidity of harp.


int laserpin =  7;                      // tell arduino laser on pin 7

int motorpin1 = 8;                      //use these names pin numbers.
int motorpin2 = 9;
int motorpin3 = 10;
int motorpin4 = 11;

int note9 = 0x61;
int note8 = 0x63;
int note7 = 0x64;
int note6 = 0x66;
int note5 = 0x68;
int note4 = 0x70;
int note3 = 0x71;
int note2 = 0x40;
int note1 = 0x47;

int a, b, c, d, e, f, g, h, = 0;       // iniating note status markers.

void setup()

{

 pinmode(8, output);                    // setup motor.
 pinmode(9, output);
 pinmode(10, output);
 pinmode(11, output);

}

  {
 pinmode(laserpin, output);            // setup laser.

 pinmode(13, output);                 // setup status led.

 serial.begin(31250);                 //  start serial communication channel midi
 
}

void noteon(int cmd, int pitch, int velocity)     // function play notes
{
 serial.write(cmd);
 serial.write(pitch);
 serial.write(velocity);
}

void loop()

{

 digitalwrite(laserpin, high);               // turn on laser 1st beam.
 delay(delaylaser);

 if ( (analogread(0) > sensor ) && (a == 0) ) // if sensor gets signal, , not not playing:
}
 {
 digitalwrite(13, high);       // switch on status led.
 noteon(0x90, note1, 0x7f);    // play note 1
 a++;                          // change status variable one.
 }


 else if(analogread(0) < sensor )             // if sensor not signal:

 {
 digitalwrite(13, low);         // switch off status led.
 noteon(0x90, note1, 0x00);     // stop playing note 1.
 a = 0;                         // change status variable zero.
 }


 digitalwrite(laserpin, low);                // turn off laser.


 digitalwrite(motorpin1, high);             // move motor create second beam.( 1 step forward)
 digitalwrite(motorpin2, low);
 digitalwrite(motorpin3, low);
 digitalwrite(motorpin4, low);
 delay(delaymotor);                          // small pause


 digitalwrite(laserpin, high);              // turn on laser 2nd beam.
 delay(delaylaser);



there more code follows but, when tried add it, system gave me error on 9000 character limit.

try deleting these curly braces:

code: [select]
pinmode(11, output);

} //<<<<<<< here

  { //<<<<<<< , here
 pinmode(laserpin, output);            // setup laser.


Arduino Forum > Using Arduino > Programming Questions > Hello, Noob here. Getting an error message


arduino

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???