Hi , I'm trying to make a stand with arduino . But the digital door does not distribute energy or sometimes program is wrong.
This is sometimes program :
void setup() {
//definindo os pinos digitais 7 e 9
//como pinos de saída.
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
digitalWrite(8,LOW);
digitalWrite(9,LOW );
}
//OBS:o método loop é executado repetidamente enquanto o
//arduino estiver ligado.
void loop() {
digitalWrite(8,HIGH); //liga a roda esquerda
delay(4000); //espera 4 segundos
digitalWrite(9,HIGH); //liga a roda direita
delay(4000); //espera 4 segundos
digitalWrite(8, HIGH); //liga a roda esquerda
digitalWrite(9,HIGH); //liga a roda direita, fazendo o carrinho ir para frente
delay(4000); //espera 4 segundos
digitalWrite(8,LOW); //desliga a roda esquerda
digitalWrite(9,LOW); //desliga a roda direita, fazendo o carrinho ir para frente
delay(4000); //espera 4 segundos
Double check your wiring, next check it again. Please provide a schematic (scan / photo of hand-drawn one is fine) so we can see how you have (or intent to have) everything connected.
Do you have a link for the mini motor? Motors are usually not connected directly to an Arduino. Normal DC motors always need a flyback diode.
Your code will do the following (in an endless loop)
set pin 8 high
wait 4 seconds
set pin 9 high
wait 4 seconds
keep both pins high
wait 4 seconds
set both pins low
wait 4 seconds