// initialize digital pin 9 as an output.
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3000); // wait for a second
digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(9, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, HIGH);(delay(1000)) ; digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second delay(20000);
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second
digitalWrite(7, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(8, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 9 as an output.
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3000); // wait for a second
digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(9, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, HIGH);(delay(1000)) ; digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second delay(20000);
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second
digitalWrite(7, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(8, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
// the loop function runs over and over again forever
void loop() {
}
This code works , but only once , and I want this code to work , just click on the button...
Delta_G:
What button? There is no button in this code.
You were asked to read the sticky thread on how to use the forum and how to properly post code. Why are you refusing to do that? Intentionally making it harder to help you is not a good way to get help.
I know that there is no button, but I need help with how I have to insert a button?!..
Connect Pin 4 to a button and the other side to GND
Hope I made no mistake while typing it quickly
void setup()
{
// initialize outputs
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
// initialize 3 as input
pinMode(4, INPUT_PULLUP);
}
void loop()
{
while (4 == LOW) // Will be executed while button on pin 4 is pressed and therefore pin 3 is connected to GND
{
digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3000); // wait for a second
digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(9, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, HIGH);
(delay(1000)) ;
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second delay(20000);
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second
digitalWrite(7, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(8, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
//Any Other Task here
delay(100);
}
Doing it that way you are 100% your code will never execute .. A digitalRead would probably help
That's an interesting comment too
I do not work, why not know ... you can check the code?
I can not properly connected, but I will say the connection order: 5v=>button=>pin4 ; GND=>pin3 (with 10k resistor)
Doing it that way you are 100% your code will never execute .. A digitalRead would probably help
That's an interesting comment too
As said I made mistakes because I quickly wrote it down.... I saw the 3 error but since this crappy forum just allows corrections after 5 minutes i was too lazy to wait for changing it
void setup()
{
// initialize outputs
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
// initialize 4 as input
pinMode(4, INPUT_PULLUP);
}
void loop()
{
while (digitalRead(4) == LOW) // Will be executed while button on pin 4 is pressed and therefore pin 4 is connected to GND
{
digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3000); // wait for a second
digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(9, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, HIGH);
(delay(1000)) ;
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second delay(20000);
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second
digitalWrite(7, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(8, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
//Any Other Task here
delay(100);
}
Gorkde:
As said I made mistakes because I quickly wrote it down.... I saw the 3 error but since this crappy forum just allows corrections after 5 minutes i was too lazy to wait for changing it
// initialize 4 as input
pinMode(4, INPUT_PULLUP);
}
woooooooooooooooow!!!.... thank youuuuuuuu )))))
void loop()
{
while (digitalRead(4) == LOW) // Will be executed while button on pin 4 is pressed and therefore pin 4 is connected to GND
{
digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3000); // wait for a second
digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(9, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, HIGH);
(delay(1000)) ;
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second delay(20000);
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second
digitalWrite(7, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(8, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Gorkde:
As said I made mistakes because I quickly wrote it down.... I saw the 3 error but since this crappy forum just allows corrections after 5 minutes i was too lazy to wait for changing it
// initialize 4 as input
pinMode(4, INPUT_PULLUP);
}
void loop()
{
while (digitalRead(4) == LOW) // Will be executed while button on pin 4 is pressed and therefore pin 4 is connected to GND
{
digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3000); // wait for a second
digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(9, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, HIGH);
(delay(1000)) ;
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second delay(20000);
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second
digitalWrite(7, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(8, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
//Any Other Task here
delay(100);
}
And can you to Add here temperature sensor control with temperature limiter?! )))
Delta_G:
Try it and we'll help you fix it if you have trouble. If you want someone to write code for you, go to the "Gigs and Collaborations" section of this forum and be prepared to pay. If you want to give it a try then we'll help you until the cows come home.
Besides, this one sentence doesn't tell enough for anyone to write it. You need to try to be a little more verbose.
I want temperature sensor control with temperature limiter...
approximately: 10 pin burned red LED on a temperature of 20celsius turned on and switched off 30celsius... pls...
Delta_G:
Try it and we'll help you fix it if you have trouble. If you want someone to write code for you, go to the "Gigs and Collaborations" section of this forum and be prepared to pay. If you want to give it a try then we'll help you until the cows come home.
Besides, this one sentence doesn't tell enough for anyone to write it. You need to try to be a little more verbose.
i try it, but , I have not left it(((
I want to learn how to do it !
I do not have money to order the code ... I'm trying to learn the swami place and need your help!....
Gorkde:
What about reading basic stuff and learning/trying yourself first?
i try it , but it did not work, this place ... I teach with your help ...
I do not have money to order the code ...I need it for my fascination....
Please ! - Accept my request and give me what you will , I will be thanks to you!...
// initialize 3 as input
pinMode(4, INPUT_PULLUP);
}
void loop()
{
while (4 == LOW) // Will be executed while button on pin 4 is pressed and therefore pin 3 is connected to GND
{
digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(3000); // wait for a second
digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(9, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, HIGH);
(delay(1000)) ;
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second delay(20000);
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(5, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(20000); // wait for a second
digitalWrite(7, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(8, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
//Any Other Task here
delay(100);
}
I want temperature sensor control with temperature limiter...
approximately: 10 pin burned red LED on a temperature of 20celsius turned on and switched off 30celsius... pls...
Instead of using a while loop. You can check the Pin state in 'void loop'. If the state changes to HIGH, call a function that will switch on one LED or 10 LED based on your requirement.
Nick Gammon explains the button usage in this post
Unfortunately, this is an English speaking board, and we only understand a small part of what you have been posting.
Instead of repeatedly asking for something we aren't understanding, try some things to learn how to use your Arduino. Your first project could be turning a LED on and off with a switch. Like the code below. Run this, and figure out exactly what it is doing, then you will be able to expand on it with more LEDs, and a temperature sensor: