I'm a very beginner an try to get a loop programmed. Here is the code:
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
// setzen Variable
int intDauer = 50;
}
// the loop function runs over and over again forever
void loop()
do
// while (intDauer > 2);
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
intDauer-- // reduziert Variable um 1
} while (intDauer >2)
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
// setzen Variable
int intDauer = 50;
}
// the loop function runs over and over again forever
void loop()
do
// while (intDauer > 2);
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
intDauer-- // reduziert Variable um 1
} while (intDauer >2)
I'm sitting a trying to learn a litte of Arduiono programming. It seem not to be simple.
I get the message:
'else' without a previous 'if'
in the following code
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
// setzen Variable
int intDauer = 50;
}
// the loop function runs over and over again forever
void loop()
{
int intDauer = 0;
if (intDauer<2000);
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(intDauer); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for a second
intDauer-200;
}
else
{
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(intDauer); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for a second
intDauer+200;
}
}
can somebody improve the code so that it works?
I would like to get the LED blinking longer, and than shorter.
Kind regards and thank you for your help a bloody beginner.
It is not that hard, you're on the right track. But just like with every language (English, Dutch, Spanish, C++, PHP) punctuation can make or break the meaning of a sentence (or line of code). So devil is in the details