element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Quiz Test your Knowledge of Arduino Fundamentals: Part I: Quiz
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: tariq.ahmad
  • Date Created: 16 Feb 2020 5:22 AM Date Created
  • Last Updated Last Updated: 6 Jun 2024 4:57 PM
  • Views 32955 views
  • Likes 20 likes
  • Comments 218 comments
Related
Recommended

Test your Knowledge of Arduino Fundamentals: Part I: Quiz

Arduino Fundamentals I

Arduino Fundamentals I
Complete our Arduino Fundamentals I quiz , like the document, and leave your feedback as a...

Are you ready to demonstrate your Arduino knowledge? Then take this 25-question quiz to test your knowledge of Arduino and see how ready you are for Arduino Certification.

To earn the Arduino Fundamentals I Badge, attain 100% on the quiz, leave us some feedback in the comments section, and give the quiz a star rating.

 

Profile

Quiz | Arduino Day 2021  | Workshop | Digital Fever  | Attack of the Drones | Project14 |Arduino Tutorials | Arduino Projects | Resource | Arduino Homepage image

  • e14quiz
  • featured_arduino
  • arduino fundamentals: part i: quiz
  • arduino fundamentals
  • quiz
  • Share
  • History
  • More
  • Cancel
  • Sign in to reply

Top Comments

  • beacon_dave
    beacon_dave over 6 years ago +10
    Question 24 depends on whether or not you are 'sinking' or 'sourcing' the LED which has been connected...
  • tariq.ahmad
    tariq.ahmad over 6 years ago +10
    There's no one way to do #13 so in hindsight it wasn't the best question. We've made a tweak to the quiz to reflect this and how people actually code. We thank everyone who took this quiz early and brought…
  • BigG
    BigG over 6 years ago +8
    Hmmm, not so sure about question 13 as you can create code such that either can apply "Place code in _____ to make an LED flash 10 times."
Parents
  • BigG
    BigG over 6 years ago

    Hmmm, not so sure about question 13 as you can create code such that either can apply "Place code in _____ to make an LED flash 10 times."

    • Cancel
    • Vote Up +8 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • du00000001
    du00000001 over 6 years ago in reply to BigG

    Placing the flashing code in setup() requires a loop (or a repetition of code).

    Contrasting to that, placing the code in loop() requires some code to stop the flashing once 10 cycles have passed.

    So flashing in setup() might be somewhat easier  image

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • phoenixcomm
    phoenixcomm over 6 years ago in reply to du00000001

    du00000001 Duh this is the way it should have been done NEVER put executable code in setup!! setup() is akin to c.h file

    what I show below  is that I used a variable 'setflash' and I set it to 0

    then in loop() I test 'setflash' to make sure it's still 0

    if its still 0 then I call my function flash() and then bump setflash to 1

    In this way, no-mater how many time loop() runs for flash will only be called the first time around! and never again.

     

    void setup() {

    int setflash = 0;}

     

    void loop {

    if (setflash == 0) {

           flash();

           setflash =1; }

    else { other stuff }}

     

    void flash( )

    // the code

    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • phoenixcomm
    phoenixcomm over 6 years ago in reply to du00000001

    du00000001 Duh this is the way it should have been done NEVER put executable code in setup!! setup() is akin to c.h file

    what I show below  is that I used a variable 'setflash' and I set it to 0

    then in loop() I test 'setflash' to make sure it's still 0

    if its still 0 then I call my function flash() and then bump setflash to 1

    In this way, no-mater how many time loop() runs for flash will only be called the first time around! and never again.

     

    void setup() {

    int setflash = 0;}

     

    void loop {

    if (setflash == 0) {

           flash();

           setflash =1; }

    else { other stuff }}

     

    void flash( )

    // the code

    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • Jan Cumps
    Jan Cumps over 6 years ago in reply to phoenixcomm

    Christina, I think that’s a personal style. Not a common one. (edit: and loop() would have no access to setflash because it’s in local scope of setup(). )

     

    Most people put variables outside the setup and loop, initialise them, and set up initial state in setup,

    And then the lifecycle code in the loop.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • du00000001
    du00000001 over 6 years ago in reply to phoenixcomm

    Christina, as Jan already commented: your code won't work because setflash would be local to setup().

     

    setup()   basically equals the initialization that's (maybe called as an initialization block) at the beginning of the "normal" main().

    loop()     equates the FOREVER loop in a standard main().

     

    I resently gauged a pit specific to the Arduino sketches, erroneously putting some variable declarations/initializations into the loop() function:

    while this is considered reasonable style in standard C programming (putting these into main() ), in sketches the initialization is repeated every time loop() is executed. Not exactly what I wanted to have  image

     

    So be advised: loop() is not main() - it's only the endless loop in main().

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube