element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
Arduino Forum Coding trouble
  • 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
Forum Thread Details
  • Replies 7 replies
  • Subscribers 392 subscribers
  • Views 1953 views
  • Users 0 members are here
Related

Coding trouble

tech_nut81
tech_nut81 over 7 years ago

Hi all. I was wondering if anyone more experienced than myself would be willing to take a look at this code and help me understand what's going wrong. I keep getting this error message, "error: unterminated argument list invoking macro "F".

 

I'll fill ya in on what I'm trying to do. I want to control the water level in a tank using a float switch, solenoid valve and the arduino. I was using just the float switch and solenoid valve connected through a relay, but whenever the water level would start dropping due to water usage, the solenoid would cycle on and off very quickly while keeping the water level up. What I want to do is have the arduino put in a 2 minute delay when the switch is activated so that the tank fills up smoothly.

 

Comments, suggestions and ideas are all appreciated.

 

DJ

Attachments:
Solenoid control.zip
  • Sign in to reply
  • Cancel

Top Replies

  • tech_nut81
    tech_nut81 over 7 years ago in reply to andywest +4
    You're right andywest , it was the double quote. I went back in a put all the F macros back in and only removed the double quotes. Compiling completed successfully after that. Thank you so much for taking…
  • andywest
    andywest over 7 years ago +3
    The F() macro is defined in WString.h , which is part of the core Arduino package. If I understand correctly, it stores a string constant in flash rather than RAM. Very useful in situations where RAM is…
  • tech_nut81
    tech_nut81 over 7 years ago in reply to shabaz +3
    Awesome! I removed all instances of 'F( and the subsequent extra ')' . After that there were a few more errors regarding extra quotation marks. Once I removed all of those compiling was successful. The…
  • shabaz
    shabaz over 7 years ago

    Hi,

     

    You've got something odd on many lines in Firmware.ino -

    for example on line 73, it says:

    Serial.println(F("\nWhich component would you like to test?"));

     

    Wherever you got the code from, someone may have created some macro 'F' (bad name for a macro) for some reason or other (no idea). In any case, if the macro no longer exists, then these Serial.println lines (there are many of them like this) need to change.

    You could strip off the characters 'F('  and one of the closing brackets, so that line 73 becomes:

    Serial.println("\nWhich component would you like to test?");

     

    That should get it to compile (or at least move on to any next error).

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • andywest
    andywest over 7 years ago

    The F() macro is defined in WString.h, which is part of the core Arduino package. If I understand correctly, it stores a string constant in flash rather than RAM. Very useful in situations where RAM is limited.

     

    I believe your problem is in Firmware.ino on line 75:

     

    Serial.println(F("(2) 12V Solenoid Valve - 3/4""));

     

    You have mismatched double quotes here. The first double quote after 3/4 terminates the string. The compiler then expects to see either more arguments or a closing parenthesis, but it encounters another double quote instead. That's what "unterminated argument list" means.

     

    To resolve this, try escaping the first double quote:

     

    Serial.println(F("(2) 12V Solenoid Valve - 3/4\""));

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • tech_nut81
    tech_nut81 over 7 years ago in reply to shabaz

    Awesome! I removed all instances of 'F( and the subsequent extra ')' . After that there were a few more errors regarding extra quotation marks. Once I removed all of those compiling was successful.

     

    The project continues....

     

    Thank you shabaz

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 7 years ago in reply to andywest

    Thanks Andy!

     

    I see, that makes sense. It's vaguely coming back to me. (I don't use Arduino enough..).

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • tech_nut81
    tech_nut81 over 7 years ago in reply to andywest

    You're right andywest , it was the double quote. I went back in a put all the F macros back in and only removed the double quotes. Compiling completed successfully after that.

     

    Thank you so much for taking the time to look at that for me.

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Cancel
  • andywest
    andywest over 7 years ago in reply to shabaz

    No problem. I mainly knew about F() because I've been programming the Arduboy recently. I agree that it's a poorly named macro.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • andywest
    andywest over 7 years ago in reply to tech_nut81

    You're quite welcome.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • 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 © 2025 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.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube