I'm an engineering freshman, and I have to write a program to blink an led light 3 times then stop. I can make it blink with a void loop, but not stop. Help.
I am completely new to this program. How do I go about doing this?
This is what I have so far. I need to make it stop blinking after 3 blinks.
void setup() {
// put your setup code here, to run once:
pinMode(13, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(300);
}
Ok, got this, and it gives me this error:
BareMinimum.cpp: In function 'void loop()':
BareMinimum:12: error: expected `}' at end of input
void setup() {
// put your setup code here, to run once:
pinMode(13, OUTPUT);
}
void loop() {
int x;
if (x < 4) {
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(300);
}
or ditch the whole
void loop() {
format and do
void loop()
{
if(true)
{
}
}
much easier to see what brackets go where IMO
dear mr. crowley,
I am having to teach myself this programming language and i would greatly appreciate it if u would shed a little more light on how this program is written. i am new to arduino and i dont understand how it is suppose to be written. so please give me a little more than a program written in another language that i also do not know
signed,
The Holy Scriber
I think Richard was just trying to make you think rather than do the job for you. But I appreciate that as a beginner it's VERY frustrating when simple things just don't work at all (heck it's frustrating when you're experienced), and C is not the most forgiving language.
thank you for your help. It is greatly appreciated.