2

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:

RobotConfig.h

#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?

Greenonline
3,1527 gold badges36 silver badges48 bronze badges
asked Jun 7, 2017 at 3:09
1
  • Do you have an #endif in RobotConfig.h ? If so, please edit your question to show it Commented Jun 7, 2017 at 3:22

1 Answer 1

3

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

answered Jun 7, 2017 at 3:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.