Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Hot answers tagged

9 votes
Accepted

Arduino command line vs. Arduino builder

The Arduino IDE command line predates arduino-builder and was made available when the source pre-processing and compiling was implemented by a Java class (deeply) embedded in the IDE. The current IDE ...
user avatar
8 votes
Accepted

How can I have code in a project that won't compile for Arduino?

I would use conditional compilation, like this: #ifndef(ARDUINO) // Non-Arduino code. #endif
user avatar
  • 35.5k
7 votes

Are there any products based on Arduino that are sold by companies?

In theory, an Arduino board could be used in some low-end professional products (i.e. where the performance and memory limitations aren't an issue). The build quality of the official boards is ...
user avatar
6 votes

Are there any products based on Arduino that are sold by companies?

Yes, you can also use an Arduino for professional usage. The Arduino is actually just a prototyping device and easy to use for people at home/school. I suppose there might be products on the market ...
user avatar
  • 386
6 votes
Accepted

Cannot compile C++11 code via Makefile

As I turns out, the avr-gcc (GCC) 4.9.1 goodies weren't being used at all! The arduino package was using a decrepit version of gcc, prakhar@sim74stic ~ $ /usr/share/arduino/hardware/tools/avr/bin/avr-...
user avatar
  • 360
5 votes

What kind of Arduino should I pick for a calculator?

For the most part, none of the AVR based arduinos are any better at number crunching than any others. They all have a single AVR core running at 16Mhz. None have an FPU, but the software floating ...
user avatar
  • 4,309
5 votes

What kind of Arduino should I pick for a calculator?

Start with the biggest (AVR) Arduino you can afford, and worry about miniaturizing it once you have the basics in place. You may find that you don't actually want an Arduino in the end, but something ...
user avatar
4 votes
Accepted

writing and uploading sketch as cpp file

See my post about How the IDE organizes things. Also see my page about how to avoid the quirks of the IDE sketch file pre-preprocessing. You can certainly manage without .ino files. As Edgar Bonet ...
user avatar
  • 35.1k
3 votes
Accepted

How does Arduino IDE for mac deal with functions in other files

arduino has its own little .ino preprocessor that generates forward declarations (like in a header file) for all function in the project's .ino files. Most of the time this just makes things less ...
user avatar
  • 4,309
2 votes
Accepted

Visual Micro without .ino files

Make a new tab in the IDE (top RH corner) with a xxx.cpp file name. Put your code in that. Leave the .ino file blank. Then it will compile. You need to add: #include <Arduino.h> ... to the ...
user avatar
  • 35.1k
2 votes
Accepted

Alternative to patching core library source and header files

Unfortunately there really isn't any way of doing that other than modifying those files. The good news is that it is perfectly viable to make the modifications under a different "core" and then amend ...
user avatar
2 votes

What kind of Arduino should I pick for a calculator?

Any Arduino (I would start with the UNO) will be sufficient to make a calculator similar to the regular HP or TI calculator product line. For the keypad, you will need to buy an I2C compatible keypad ...
user avatar
  • 254
2 votes
Accepted

Good way to get automatically generated code into a sketch

According to the release notes starting with V1.5.2 of the IDE you can verify and upload from the command line. You could use your favorite editor and then use the command line to do the arduino ...
user avatar
  • 2,090
2 votes

Are there any products based on Arduino that are sold by companies?

Yes, I work for an engineering design house and we use Arduino frequently to prototype ideas for clients. It significantly speeds up the time to get a proof-of-concept device in the hands of the ...
user avatar
  • 21
2 votes

See compiled assembly output (Visual Micro)

Turn on Verbose Compiling in the Arduino IDE and you will see all the intermediate file names (they are done in a temporary folder). For example: /home/nick/Development/arduino-1.6.7/arduino-builder ...
user avatar
  • 35.1k
2 votes
Accepted

Visibility of #define between sketch and library

You need a common place that the building of all the places can get the definition from. That isn't the sketch. The sketch is one of the things that would have to look at that common place. That can ...
user avatar
  • 101k
2 votes
Accepted

How to rebuild Arduino core for ESP8266

There are four variants of LwIP bundled with the ESP8266 core: V1.4 (Compile from source) V1.4 (Precompiled) V2 Lower Memory V2 Higher Bandwidth By default (for most boards) one of the V2 variants ...
user avatar
  • 101k
2 votes
Accepted

Undefined reference in Eclipse of .h and .cpp files

Have you tried placing the H file in the same folder as you main cpp file. This should prove beyond all doubt that there is nothing wrong with the code (I can't see anything wrong). I suspect its a ...
user avatar
  • 5,596
1 vote

How to programmatically upload an Arduino sketch generated by node.js (electron) or from browser?

There are two things you need to do: Compile the sketch into a .HEX file Upload the sketch to the board The first part can be done with arduino-builder which is part of the IDE since 1.6.6, or you ...
user avatar
  • 101k
1 vote

Compiling sketch vi command line

In the Arduino IDE preferences, select external editor. Then you can write/ edit your sketches with any editor you choose. When you click compile or upload on the IDE toolbar, it will load your ...
user avatar
  • 14.4k
1 vote
Accepted

avr_g++ compiler error: expected primary-expression before '.' token (C code in .ino)

.ino is compiled as C++. your test is C code. put the C code in a .c file and the declaration in .h file and include the .h in .ino I created a test.c, copied the content of your main.c into it and ...
user avatar
  • 16.1k
1 vote

Reason for warning "avr:build doesn't define a 'build.board' preference" when build.board is explicitly set in boards.txt?

In my case: I erase the board configurations that was with problem in the file boards.txt. These configurations appears between #### ... board configurations... #####.
user avatar
1 vote
Accepted

Reason for warning "avr:build doesn't define a 'build.board' preference" when build.board is explicitly set in boards.txt?

It appears that you can no longer set a global property in the boards.txt file. You must set every property individually inside each board ID, even if they are the same for every board in the file. ...
user avatar
  • 1,450
1 vote

What is the correct way to create large project files?

Good to hear you are splitting large amount of code, it will benefit you a lot in the long run. It's very hard to say what is best, it depends on the interaction of those patterns with other classes. ...
user avatar
1 vote

Complex Arduino programs

Yes you can have multiple files without classes. Functions don't have to go in classes, see loop and setup for an example. All you have to do is declare the function in a header file and then ...
user avatar
  • 5,596
1 vote

Complex Arduino programs

I noticed that it is very hard to use classes with the default IDE. Each file will be in a different tab, but normally each class has a header (.h) and implementation (.c) file, so 2 extra tabs per ...
user avatar
1 vote

How to use same sketch on two different computers in two different directories

Open preferences.txt in C:\Users\YourUserName\AppData\Roaming\Arduino and change the path of sketchbook.path=C:\Users\YourUserName\Documents\Arduino to sketchbook.path=YourDesiredPath.
user avatar
  • 379
1 vote

What would be the architecturally-right place to put custom -D defines?

That is a tough one... Because arduino-builder is basically a custom go script you don't get the facilities you get in a Makefile, like shell execution. I would be inclined to do this kind of thing ...
user avatar
  • 101k
1 vote

Arduino command line vs. Arduino builder

I've written a new option for Arduino CI/unit testing and put together a decent size writeup about it as an answer to this related question. I ended up using the Arduino command line instead of ...
user avatar
  • 181
1 vote

Understanding global variables on Arduino

I suggest you take a look at https://stackoverflow.com/questions/16274451/operator-new-for-arduino the new operator is not coming from the c++ libraries, it is coming from the Arduino libraries. It's ...
user avatar
  • 207

Only top scored, non community-wiki answers of a minimum length are eligible