queria fazer uma réplica de um brinquedo (Genius) fui baixar e deu erro:
error: expected unqualified-id before numeric constant
float 1;
^
error: expected unqualified-id before numeric constant
float 2;
^
error: expected unqualified-id before numeric constant
float 3;
^
error: expected unqualified-id before numeric constant
float 4;
^
error: expected unqualified-id before numeric constant
float 5;
^
error: expected unqualified-id before numeric constant
float 6;
^
error: expected unqualified-id before numeric constant
float 7;
^
error: expected unqualified-id before numeric constant
float 8;
^
error: expected unqualified-id before numeric constant
float 9;
^
error: expected unqualified-id before numeric constant
float 10;
^
In function 'void setup()':
error: lvalue required as left operand of assignment
1 = 0;
^
error: lvalue required as left operand of assignment
2 = 0;
^
error: lvalue required as left operand of assignment
3 = 0;
^
error: lvalue required as left operand of assignment
4 = 0;
^
error: lvalue required as left operand of assignment
5 = 0;
^
error: lvalue required as left operand of assignment
6 = 0;
^
error: lvalue required as left operand of assignment
7 = 0;
^
error: lvalue required as left operand of assignment
8 = 0;
^
error: lvalue required as left operand of assignment
9 = 0;
^
error: lvalue required as left operand of assignment
10 = 0;
^
In function 'void loop()':
error: lvalue required as left operand of assignment
1 = (random(1, 4));
^
error: lvalue required as left operand of assignment
2 = (random(1, 4));
^
exit status 1
progamaçao:(usei um tradutor de código)
//This c++ code is generated by PictoBlox
//Gloabl Variables are declared here
float nivel;
float 1;
float 2;
float 3;
float 4;
float 5;
float 6;
float 7;
float 8;
float 9;
float 10;
void setup() {
//put your setup code here, to run once:
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
nivel = 0;
1 = 0;
2 = 0;
3 = 0;
4 = 0;
5 = 0;
6 = 0;
7 = 0;
8 = 0;
9 = 0;
10 = 0;
digitalWrite(3, true);
delay(0.5 * 1000);
digitalWrite(3, false);
}
void loop() {
//put your main code here, to run repeatedly:
if((nivel > 0)) {
1 = (random(1, 4));
}
if((1 == 1)) {
digitalWrite(2, true);
delay(1 * 1000);
digitalWrite(2, false);
delay(0.5 * 1000);
}
if((1 == 2)) {
digitalWrite(4, true);
delay(1 * 1000);
digitalWrite(4, false);
delay(0.5 * 1000);
}
if((1 == 3)) {
digitalWrite(7, true);
delay(1 * 1000);
digitalWrite(7, false);
delay(0.5 * 1000);
}
if((1 == 4)) {
digitalWrite(8, true);
delay(1 * 1000);
digitalWrite(8, false);
delay(0.5 * 1000);
}
if((nivel > 1)) {
2 = (random(1, 4));
}
if((2 == 1)) {
digitalWrite(2, true);
delay(1 * 1000);
digitalWrite(2, false);
delay(0.5 * 1000);
}
if((2 == 2)) {
digitalWrite(4, true);
delay(1 * 1000);
digitalWrite(4, false);
delay(0.5 * 1000);
}
if((2 == 3)) {
digitalWrite(7, true);
delay(1 * 1000);
digitalWrite(7, false);
delay(0.5 * 1000);
}
if((2 == 4)) {
digitalWrite(8, true);
delay(1 * 1000);
digitalWrite(8, false);
delay(0.5 * 1000);
}
}