Please post your schematic here in the forum, a lot of people won't go looking on an external website. Also remember that this is an international forum, the person who can help might be in another country and timezone, perhaps asleep, at work or down the pub getting drunk. You have to wait a while.
It was only to refloat the thread.
Here is the shematic, I didn´t know I can insert it here directly
Ok, well, that's better than nothing...
But most here hate Fritzy diagrams, they are not schematics. Please read my tutorial about how to get the best out of this forum, particularly the bit about schematics. Hand drawn and photographed is way better.
Thanks.
I don't see anything powering your Uno.
it´s connected to the computer.
Will it always be connected to the computer?
Your loop is riddled with delays. You should learn to count millis. See example blink without delay
Try this
const int boton1 = 2;
const int bomba1 = 10;
void setup()
{
pinMode(bomba1, OUTPUT);
}
void loop()
{
if (digitalRead(boton1) == HIGH)
{
// Enciende la bomba 1 durante 3 segundos
digitalWrite(bomba1, HIGH);
delay(3000); // Modifica el tiempo aqui, en milisegundos
digitalWrite(bomba1, LOW);
}
}
After it works , add more things one by one(or take care of the delays)
I added a delay so you can see it go off, and made it go faster. And off the bomb to an LED.
void loop()
{
if (digitalRead(boton1) == HIGH)
{
digitalWrite(led1, HIGH);
delay(500);
digitalWrite(led1, LOW);
delay(500);
}
}
You can make changes and test every input and output and LED and bomb.
a7
Now
has LEDs and buttons and seems to do what the code says, so does your real life thing do the same and is that what you want?
a7
The code does the same, it goes erratic sometimes going forever and sometimes going for 3 seconds, and the next time I push the button the behaviour changes again
I tried with this code uploaded above:
const int boton1 = 2;
const int bomba1 = 10;
void setup()
{
pinMode(bomba1, OUTPUT);
}
void loop()
{
if (digitalRead(boton1) == HIGH)
{
// Enciende la bomba 1 durante 3 segundos
digitalWrite(bomba1, HIGH);
delay(3000); // Modifica el tiempo aqui, en milisegundos
digitalWrite(bomba1, LOW);
}
}
But it does the same, I can put a 10ms delay and stay for 20 seconds, or put 3000ms and stay for 5 seconds.
EDIT: I just find out that only the pump connected to pin 10 (pump1). If you change the code to pin 6 (pump2) the pump2 runs again. Seems electrical more than the code.
The motors are connected in the protoboard one and in the same row (just like Fritzing) maybe that is making the trouble (?) should I try putting one in each half of the protoboard? Or it doesn´t make sense?
The sketck I have posted was not even supposed to work (without a delay after "digitalWrite(bomba1, LOW);"), sorry about that.
Maybe your motors draw too much current for the breadboard.
Sry, if you mean the simulation I posted goes erratic at some point please describe how to make that happen.
If you have found the simulation to function to your plans, then it seems to indicate that you have an hardware problem.
a7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.