DC Motor & L293D
hi!
i wondered if somesone me solve problem
i want program arduino uno in order control system consists in window opens automatically whenever there not enough sun , closes automatically @ night.
if there enough sun window not open.
so in other words resume following:
1. if window opens in morning ( lets weather not sunny) cause ldr system has, must receive sun, window must close @ night.
2. if windows not open, will not close.
i submit image of circuit using , arduino's program
diagram

program
as can see typed of code in setup area cause read in 1 topic here @ forum if did not wanted use loops, had place program in setup part , leave loop part blank.
the circuit works ldr produces voltage depending of sun light receives.
then, thank output, voltaje goes through opam , voltage duplicated opam configuration. output voltage of opam conected arduino's analog input a4 , in other part, 2 terminals conected in order enable different combinations work h bridge in order control motor connected it.
one of other things saw if left program in loop part whenever program executed itself, excuted again , again... caused motor kept turning , never stop, if light went trough ldr corret have more 2v, voltage should had worked arduino in order stop motor working , close window @ night.
so wondered if placing code in setup space worked me, did not work either...
thanks in advance
i wondered if somesone me solve problem
i want program arduino uno in order control system consists in window opens automatically whenever there not enough sun , closes automatically @ night.
if there enough sun window not open.
so in other words resume following:
1. if window opens in morning ( lets weather not sunny) cause ldr system has, must receive sun, window must close @ night.
2. if windows not open, will not close.
i submit image of circuit using , arduino's program
diagram
program
code: [select]
int valor_luz=0;
int entradamotor1 = 4;
int entradamotor2 = 5;
void setup()
{
pinmode(entradamotor1, output);
pinmode(entradamotor2, output);
pinmode(2, output); // pin led
serial.begin(9600);
valor_luz=analogread(a4);
delay (500);
if (valor_luz>410) // if ldr receives light led not turn on
digitalwrite (2,high);
if (valor_luz<410) // if ldr not receive light led turn on
digitalwrite (2,low);
if (valor_luz>410 ) // 2v
{
subir (2000);
neutral (2000);
bajar (1000); //this intruction continues executing indefinetely. not respect parameter has time "1000 ms"
}
}
void loop()
{
}
void subir (int w)
{
digitalwrite(entradamotor1,high);
digitalwrite(entradamotor2,low);
delay(w);
}
void neutral (int x)
{
digitalwrite(entradamotor1,low);
digitalwrite(entradamotor2,low);
delay (x);
}
void bajar (int y)
{
digitalwrite(entradamotor1,low);
digitalwrite(entradamotor2,high);
delay(y);
}
as can see typed of code in setup area cause read in 1 topic here @ forum if did not wanted use loops, had place program in setup part , leave loop part blank.
the circuit works ldr produces voltage depending of sun light receives.
then, thank output, voltaje goes through opam , voltage duplicated opam configuration. output voltage of opam conected arduino's analog input a4 , in other part, 2 terminals conected in order enable different combinations work h bridge in order control motor connected it.
one of other things saw if left program in loop part whenever program executed itself, excuted again , again... caused motor kept turning , never stop, if light went trough ldr corret have more 2v, voltage should had worked arduino in order stop motor working , close window @ night.
so wondered if placing code in setup space worked me, did not work either...
thanks in advance

hi,
your problem arduino resetting due insufficient or noisey power.
what using power ?
is there decoupling on power between motors , arduino ?
are putting same voltage 293 through vss , vs ?
duane b
your problem arduino resetting due insufficient or noisey power.
what using power ?
is there decoupling on power between motors , arduino ?
are putting same voltage 293 through vss , vs ?
duane b
Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > DC Motor & L293D
arduino
Comments
Post a Comment