Tuesday, 17 December 2013 21:51

Arduino function with optional argument(s)

Written by
Function Declaration and Function Prototypes: function prototype allowing the function to be used before it is defined.
functionReturnType myFunctionName(optionalArgumentType optionalArgument = defaultValue);
 
Function Implementation

functionReturnType myFunctionName(optionalArgumentType optionalArgument);
{
   // put your code here
}

 
Function calls

myFunctionName(); // Use the default value
myFunctionName(1); // Use specific value

 
Example
  1. int myFunction(int optionalArgument = 1);
  2.  
  3. void setup() {
  4. Serial.begin(9600);
  5. }
  6.  
  7. void loop() {
  8. Serial.println(myFunction()); // Use the default value
  9. Serial.println(myFunction(2)); // Use specific value
  10. }
  11.  
  12. int myFunction(int optionalArgument)
  13. {
  14. return optionalArgument;
  15. }
 
Read 25473 times Last modified on Tuesday, 17 December 2013 22:12

19 comments

  • Comment Link Stevambums Sunday, 02 February 2020 14:02 posted by Stevambums

    Amoxil 875 Safe In Pregnancy [url=http://cheapcialisir.com]Cialis[/url] What Does Cephalexin Look Like Cialis Levitra 40 Mg Best Price

  • Comment Link MatWeetle Thursday, 23 January 2020 13:21 posted by MatWeetle

    Buy Kamagra In Bali http://cialibuy.com - Cialis Cialis Mg Preisvergleich Buy Cialis Viagra 8 Mg

  • Comment Link Aappencyavafe Wednesday, 22 January 2020 02:56 posted by Aappencyavafe

    significance http://cialisoni.com/# - buy cialis colonial buy cialis raise
    executive https://cialsagen.com/# - buy viagra generic online usa pharmacy where can i buy generic viagra viagra online no prior prescription discover

  • Comment Link Aappencyavafe Tuesday, 21 January 2020 12:46 posted by Aappencyavafe

    badly http://cialisle.com/# - online cialis nose cheap cialis online resistance
    address https://cialsagen.com/# - viagra generic online usa pharmacy generic viagra canadian viagra generic pharmacy reviews corporate

  • Comment Link Aappencyavafe Monday, 20 January 2020 10:22 posted by Aappencyavafe

    found http://cialisoni.com/# - cheap tadalafil reputation buying cialis online one
    reality https://cialsagen.com/# - generic viagra generic viagra viagra best buy student

  • Comment Link Stevambums Sunday, 19 January 2020 05:16 posted by Stevambums

    Purchase Flagyl In Chula Vista Cialis Priligy Farmacia Ahumada Quik Delivery Of Vermox

  • Comment Link MatWeetle Saturday, 18 January 2020 20:10 posted by MatWeetle

    Canada Pharmach Amoxicillian Canadian Express Pharmacy cialis online Cialis Tadalafil 20mg Original Propecia Orquitis

  • Comment Link Aappencyavafe Wednesday, 08 January 2020 07:48 posted by Aappencyavafe

    breast http://cialisoni.com/# - order cialis trouble online cialis pretty

  • Comment Link Aappencyavafe Monday, 06 January 2020 03:49 posted by Aappencyavafe

    rail http://cialisle.com/# - order cialis field generic cialis online leave

  • Comment Link WilliamVed Wednesday, 01 January 2020 21:36 posted by WilliamVed




    918indo_13102019
    ANSI
    RobertCom
    RobertComYR
    $aptK7k1y7K
    [email protected]
    GDLVDNU622
    [email protected]
    pop.gmail.com

    124456847
    Maputo
    Mozambique
    Service
    Cycling



    0













    áèçíåñ
    äîñóã
    îáúÿâ
    êóðèëêà
    ôëåéì
    ôëýéì
    îñíîâí
    ðàçâëå÷
    îôôòîïèê
    îôòîïèê
    îôô-òîïèê
    ïðî÷åå
    ðàçíîå
    îáî âñ¸ì
    flood
    flame
    stuff
    blah
    off-topic
    off topic
    offtopic
    oftopic
    general
    common
    business
    îáùà
    îáùèé
    îáùåå
    îáùèå
    ðåêëàì
    adver
    false

  • Comment Link RubenhiesY Monday, 02 December 2019 05:22 posted by RubenhiesY

    SportsBook – 5Bintang Kasino http://www.5bintangkasino.com/sportsbook/ - More info!

  • Comment Link RobertCom Monday, 02 December 2019 03:24 posted by RobertCom

    live casino slots – 918indo.com More info...

  • Comment Link DennisHausa Sunday, 01 December 2019 06:07 posted by DennisHausa

    Comments for xe-88.asia http://www.xe-88.asia/comments/feed/ - Show more!

  • Comment Link DennisHausa Friday, 29 November 2019 15:14 posted by DennisHausa

    http://www.xe-88.asia/sitemap-misc.xml - More info>>>

  • Comment Link WilliamVed Friday, 29 November 2019 14:14 posted by WilliamVed




    918indo_13102019
    ANSI
    RobertCom
    RobertComYR
    $aptK7k1y7K
    [email protected]
    GDLVDNU622
    [email protected]
    pop.gmail.com

    124456847
    Maputo
    Mozambique
    Service
    Cycling



    0













    áèçíåñ
    äîñóã
    îáúÿâ
    êóðèëêà
    ôëåéì
    ôëýéì
    îñíîâí
    ðàçâëå÷
    îôôòîïèê
    îôòîïèê
    îôô-òîïèê
    ïðî÷åå
    ðàçíîå
    îáî âñ¸ì
    flood
    flame
    stuff
    blah
    off-topic
    off topic
    offtopic
    oftopic
    general
    common
    business
    îáùà
    îáùèé
    îáùåå
    îáùèå
    ðåêëàì
    adver
    false

  • Comment Link RubenhiesY Wednesday, 27 November 2019 14:59 posted by RubenhiesY

    Rollex – 5Bintang Kasino http://www.5bintangkasino.com/rollex/ - Rollex – 5Bintang Kasino!..

  • Comment Link DennisHausa Monday, 25 November 2019 18:27 posted by DennisHausa

    xe-88.asia http://www.xe-88.asia/feed/ - xe-88.asia!

  • Comment Link RubenhiesY Monday, 25 November 2019 18:27 posted by RubenhiesY

    Login 918Kiss – 5Bintang Kasino http://www.5bintangkasino.com/login-918kiss/ - Login 918Kiss – 5Bintang Kasino!

  • Comment Link WilliamVed Sunday, 24 November 2019 10:55 posted by WilliamVed




    918indo_13102019
    ANSI
    RobertCom
    RobertComYR
    $aptK7k1y7K
    [email protected]
    GDLVDNU622
    [email protected]
    pop.gmail.com

    124456847
    Maputo
    Mozambique
    Service
    Cycling



    0













    áèçíåñ
    äîñóã
    îáúÿâ
    êóðèëêà
    ôëåéì
    ôëýéì
    îñíîâí
    ðàçâëå÷
    îôôòîïèê
    îôòîïèê
    îôô-òîïèê
    ïðî÷åå
    ðàçíîå
    îáî âñ¸ì
    flood
    flame
    stuff
    blah
    off-topic
    off topic
    offtopic
    oftopic
    general
    common
    business
    îáùà
    îáùèé
    îáùåå
    îáùèå
    ðåêëàì
    adver
    false

Leave a comment

Back to Top