Hi guys, i´m here in hope to know what´s happening , my project it´s a traffic light and I can´t understand why the functions doesn´t work here is it:
//Atribuindo à uma variavel um numero de pino.
int verde = 8;
int amarelo = 7;
int vermelho = 6;
void setup() {
//Definição dos pinos ENTRADA/SAIDA de dados.
pinMode(verde, OUTPUT);
pinMode(amarelo, OUTPUT);
pinMode(vermelho, OUTPUT);
}
void loop() {
int ciclonormal();
}
int ciclonormal() { //Define a função do ciclo nromal
digitalWrite(vermelho, HIGH);
delay(1000);
digitalWrite(vermelho,LOW);
delay(50);
digitalWrite(verde, HIGH);
delay(1000);
digitalWrite(verde, LOW);
delay(50);
digitalWrite(amarelo, HIGH);
delay(500);
digitalWrite(amarelo, LOW);
delay(50);
}
Hello
Welcome to the Arduino fora.
Before you do anything else please take a moment to read General guidance
And How to use this forum
Especially item #7 on posting code (code tags good, complete mess bad).
What does 'doesn't work' mean? What should it do? What does it do instead?
Yes. It calls the function and as long as the function is not declared void and returns an int it will be assigned to the x variable that has just been declared
UKHeliBob:
Yes. It calls the function and as long as the function is not declared void and returns an int it will be assigned to the x variable that has just been declared