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"
// ...