I'm trying to put all my settings in a config.h file and then #include it in the Arduino sketch.

Here's what my config.h looks like:


#ifdef BOT
    //hardware pins
    int motor1Pin = 9; //s0
    int motor2Pin = 10; //s1

    //pins for light
    int light2 = A4; 
    int light3 = A2; //right
    int light1 = A1; //left

And here's what .ino sketch looks like:

#define BOT
#include "RobotConfig.h"

void setup() {
  //Light INIT
  pinMode(light1, OUTPUT); //left light with motor1/s1 in front
  pinMode(light2, OUTPUT); //middle light with motor1/s1 in front
  pinMode(light3, OUTPUT); //right light with motor1/s1 in front

This compiles fine on my Mac but I'm trying to compile this on Raspberry Pi (Pi3 with new Jessie install with sudo apt-get install arduino) and get an error while doing so. The error says:

A1 was not declared in the scope etc.

What am I missing?

  • Do you have an #endif in RobotConfig.h ? If so, please edit your question to show it Jun 7, 2017 at 3:22

1 Answer 1


RobotConfig.h needs to include Arduino.h in order to have those constants.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.