Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Greetings from a newbie.
I grew up in the analog days so the shift to programing code is a challenging one.
I have blink running on a nano and have been able to set various blink rates by altering the timing on the supplied code. Yay, my first bit of coding, as basic as it is i did it :)

I am specifically seeking an explanation for the use of the symbols { }. These symbols are causing me grief and errors for that matter.

Looking at page 17 of exploring Arduino by Jeremy Blum he uses these symbols in a string of code with explanations of everything but these symbols. Why would these not get discussed ?
I dont understand there meaning or how to use them, they appear at the start and the end of a program.
Further to this can someone explain how to run blink program once, and then how to change it to repeat.
As you can see I have no experience with C, I would appreciate any literature on a beginners guide to C if or the like. Thanks in advance. Mark from NZ.

What I have tried:

The Net,
exploring Arduino by Jeremy Blum
Posted
Updated 1-Feb-19 12:10pm
Comments
Member 14137559 1-Feb-19 19:54pm    
Program will not fit into space provided.
I will send the first and last which is where the problem exists.

void setup() {
// put your setup code here, to run once:
// put your main code here, to run repeatedly:
// the loop function runs over and over again forever

// A DA is equal to 3 dits
// The space between parts ot the same letter is equal to one dit
// The bspace between two letters is equal to three dits
// The space between two words is equal to sevin dits.




// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {

digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(300); // wait for a second. DA Z
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for 5 second.
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)

and the last..

digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(5000); // wait for 5 second

}

1 solution

Curly braces have many usages. One of the is to group a sequence of statements in a block.
You may find info here Arduino Reference[^] and here Fundamentals of C Programming/Preliminaries - Wikibooks, open books for an open world[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900