Linked Questions
25 questions linked to/from Classes and objects: how many and which file types do I actually need to use them?
2
votes
1
answer
33k
views
How to add .h file in library [duplicate]
I am trying to make an ultrasonic distance meter using Arduino. For this I added the ultrasonic library. But on compiling it shows this error "ultrasonic.h
not available". Please tell me how to add ...
13
votes
2
answers
12k
views
Will a .ino Arduino Sketch compile directly on GCC-AVR?
Okay, we all have seen those questions all over the web such as Arduino v.s. C++, or other similar questions. And a vast majority of the answers do not even touch compilation differences other than ...
8
votes
3
answers
3k
views
Arduino screws up trivial program involving enum
Behold this insanity:
enum WhatArduinoIs {
Easy, But, Insane, Obsolete, And, Far, Worse, Than, mBed
};
void TellMe(WhatArduinoIs pls) { }
void setup() { }
void loop() { }
I'm pretty good at C++, ...
2
votes
3
answers
4k
views
How to include <SPI.h> outside the .ino file
As I understand, Arduino IDE considers two paths for the libraries:
first,
"C:\Program Files\Arduino\libraries"
and second, the "libraries" folder next to the schetchbook.
I have a configuration....
3
votes
2
answers
2k
views
What exactly does the Arduino preprocessor do?
Arduino claims to be a "language," not just an "application framework," and Arduino files have their own extension, .ino. The language is obviously C++, but not quite. My understanding is that ...
1
vote
2
answers
10k
views
Arduino declaring class in h and cpp file Undefined Reference
I am trying to compile my project, but unfortunately get errors.
I created class and separated implementation and declaration (cpp file and h file)
Here they are
sensor.h
#ifndef SENSOR_H
#...
3
votes
2
answers
2k
views
is #ifdef __SD_H__ considered a bad practice?
Say I'm working on a library^1 to which I want to add support for SD.h^2 but knowing for a fact that many microcotrollers don't support SD.h (therefore they result in compilation errors [eg. Attiny85])...
2
votes
3
answers
3k
views
Typedef not accepted as a data type in a function?
I know I'm in a C++ compiler, but I typically create a typedef from structures, probably a holdover from earlier C programming. So this has my head spinning. I create a Typedef from a structure. After ...
9
votes
3
answers
3k
views
How to write makefile-compatible sketches?
I'd like to write my sketches so that I can either build/upload them using the Arduino IDE, or optionally using GCC and a makefile.
I know about including the function declarations at the top, but is ...
0
votes
2
answers
4k
views
Why can't the new Arduino IDE 1.6.7 compile extern "C"?
Consider:
I having a problem in compiling in extern "C" code in the Arduino IDE 1.6.7 which I don't have on version 1.6.5.
The error is:
error: conflicts with new declaration with 'C' linkage
It is ...
1
vote
1
answer
3k
views
Pass class's public function as an argument to external command
I am trying to write a library for encoders.
main.ino:
#include <./Encoders.h>
Encoders encoders();
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print("&...
2
votes
2
answers
2k
views
Own type definition using a struct does not name a type
I need to initialize several buttons and LEDs connected to my Arduino. To store data related to an individual button or LED, I decided to define my own data type using two different structs. One for a ...
2
votes
5
answers
399
views
Break a big file into smaller files
I had a really big .ino file and I decided to break it down into sub-files.
So I had the .ino file, the globals.h file and the functions.h file.
I moved all the global vars and functions to their ...
1
vote
1
answer
3k
views
writing and uploading sketch as cpp file
I want to use only *.cpp files and no *.ino anymore. I read a lot of stuff about how to upload c++ instead of arduino sketches. But still I was not able to find a step by step guide how to do it.
...
1
vote
1
answer
4k
views
I2Cdev #include weirdness
I am using Jeff Rowberg's MPU6050 library, and I simply don't understand what is going on in the following lines of the first example (MPU6050_raw.ino):
#include "I2Cdev.h"
#include "MPU6050.h"
// ...
1
vote
1
answer
3k
views
Including libraries from header files sometimes doesn't work
I, once again have difficulties including libraries from code files other than my .ino file.
I have several .cpp and .h files in my project to keep it sorted and clean.
However one of my header ...
0
votes
2
answers
2k
views
Visual Micro without .ino files
I am using the visual micro extension for Visual Studio 2015. I would like to not use any .ino files since I'm trying to setup cppcheck which doesn't recogonize .cpp files, and its just what I'm used ...
0
votes
2
answers
2k
views
SoftwareSerial library
How do I rectify this error?
Clearly it says there is some error in the library, so how do I correct it?
C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:1: error: expected ...
0
votes
1
answer
2k
views
Library, instantiation of a class object
I am python experienced, an arduino noob, and absolutely no experience of C other than what has been forced upon me by arduino use.
I have just spent a day hammering google for the precise syntax of ...
1
vote
2
answers
1k
views
Arduino IDE not handling library code correctly?
The author of the PinChangeInt library and the EnableInterrupt library states at github:
When the PinChangeInt was in a .h and .cpp file, the Arduino IDE tried
to compile it twice. I have a ...
1
vote
3
answers
881
views
Is there a way to strip a library from all unused parts and defines, automatically?
Say you want to investigate part of the code you use from a rather large library, but it's buried between all kinds of #defines and classes etc, that you're never gonna use in your code.
Is there a ...
0
votes
1
answer
536
views
Inheritance: error in calling the constructor of the base class?
I want to write a library for the RGBDigit shield (http://rgbdigit.com/), which essentially is an Adafruit Neopixel strip, packed as a 7 segment display. The shield also has a DS3231 clock and an IR ...
1
vote
1
answer
255
views
Requesting references for learning about the upload process
I would like to know of references that discuss the process of uploading code onto an Arduino board. I have read this reference on hacking the Arduino and an outline of the build process. I also found ...
0
votes
1
answer
232
views
Compilling error not highlighting line in code
A newbe here. How come when I compile with an error I do not get the line or line number highlighted? I Get the errors just can't find where they are.
0
votes
1
answer
83
views
Why is char being "extended" to an int?
I know I'm missing something so simple here, but I can't figure it out.
If I do char letter = 'A'; then letter = letter << 8, letter = 0, as one should expect, since we are shifting the bits &...