1298Views7Replies

Author Options:

arduino error. exit status 1 expected unqualified-id before '<' token arduino ? Answered

i'm tring to make a led light bar random number generator thing but my code is sadly not working and i do not nkow why pleae help

here is the error message: exit status 1 expected unqualified-id before '<' token arduino

here is the code

<p>int LED0 = 2;<br>int LED1 = 3;
int LED2 = 4;
int LED3 = 5;
int LED4 = 6;
int LED5 = 7;
int LED6 = 8;
int LED7 = 9;
int LED8 = 10;
int LED9 = 11;</p><p>long randomNumber;</p><p>void setup() {
Serial.begin(9600);</p><p>Serial.println("Randon Numbernesssssss");</p><p>pinMode(LED0, OUTPUT);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
pinMode(LED5, OUTPUT);
pinMode(LED6, OUTPUT);
pinMode(LED7, OUTPUT);
pinMode(LED8, OUTPUT);
pinMode(LED9, OUTPUT);</p><p>randomSeed( analogRead(A0) );</p><p>}</p><p>void loop() {
randomNumber = random(2,12);</p><p>Serial.println(randomNumber);</p><p>digitalWrite(randomNumber,HIGH);</p><p>delay(40);</p><p>digitalWrite(randomNumber,LOW);</p><p>}</p><p>

7 Replies

user
steveastroukBest Answer (author)2016-08-22

You have downloaded HTML formatted code. You need to try and get clean text.

Select as Best AnswerUndo Best Answer

user

hey thanks so what shold i do

Select as Best AnswerUndo Best Answer

user

Try this: Everywhere you see < and > delete them and what's between them.

int LED0 = 2;int LED1 = 3;
int LED2 = 4;
int LED3 = 5;
int LED4 = 6;
int LED5 = 7;
int LED6 = 8;
int LED7 = 9;
int LED8 = 10;
int LED9 = 11;long randomNumber;void setup() {
Serial.begin(9600);
Serial.println("Randon Numbernesssssss");
pinMode(LED0, OUTPUT);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
pinMode(LED5, OUTPUT);
pinMode(LED6, OUTPUT);
pinMode(LED7, OUTPUT);
pinMode(LED8, OUTPUT);
pinMode(LED9, OUTPUT);

randomSeed( analogRead(A0) );
void loop() {

randomNumber =
random(2,12);
Serial.println(randomNumber);
digitalWrite(randomNumber,HIGH);
delay(40);
digitalWrite(randomNumber,LOW);}

Select as Best AnswerUndo Best Answer

user

sorry itis not working

C:\Users\user\Documents\Arduino\led_bar_2\led_bar_2.ino: In function 'void setup()':

led_bar_2:24: error: a function-definition is not allowed here before '{' token

void loop() {

^

led_bar_2:31: error: expected '}' at end of input

digitalWrite(randomNumber,LOW);}

^

exit status 1

a function-definition is not allowed here before '{' token

Select as Best AnswerUndo Best Answer

user

Do you know anything about programming ?

Select as Best AnswerUndo Best Answer

user

ok thanks so much ill try just that

Select as Best AnswerUndo Best Answer

user
Downunder35m (author)2016-08-22

Please tell me you did not try to past HTML code into the Arduino IDE....

Select as Best AnswerUndo Best Answer