This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP432P401R: Energia MultiAnalogInput compile error

Part Number: MSP432P401R
Other Parts Discussed in Thread: ENERGIA

Hi,

I was working through some of the the MultiTasking examples in Energia for the MSP432 and I ran into a compile error when trying to run the MultiAnalogInput example. 

The version I am running is  Energia 18 aka Energia 1.6.10E18 on MacOSX 10.9.5, however the version listed in the Library folder is Energia15. (??)

This is part of the error output I get:

Energia15/packages/energia/hardware/msp432/3.8.0/system" "-I/Users/jonnymo/Library/Energia15/packages/energia/hardware/msp432/3.8.0/cores/msp432" "-I/Users/jonnymo/Library/Energia15/packages/energia/hardware/msp432/3.8.0/variants/MSP_EXP432P401R" "/var/folders/kd/nz4bt2g1255fncpc9bj8pgnh0000gn/T/build2ea6ebefa65a20ff18809c7e85905d34.tmp/sketch/MultiAnalogInput.ino.cpp" -o "/var/folders/kd/nz4bt2g1255fncpc9bj8pgnh0000gn/T/build2ea6ebefa65a20ff18809c7e85905d34.tmp/sketch/MultiAnalogInput.ino.cpp.o"
/private/var/folders/kd/nz4bt2g1255fncpc9bj8pgnh0000gn/T/arduino_modified_sketch_560586/Analog2.ino: In function 'void loopAnalog()':
Analog2:7: error: 'sensorValue' was not declared in this scope
sensorValue = analogRead(sensorPin);
^
Analog2:7: error: 'sensorPin' was not declared in this scope
sensorValue = analogRead(sensorPin);
^
exit status 1
'sensorValue' was not declared in this scope

To work around this, since there are shared variables, I added a MultiAnalogInput.h file (tab) with the following:

extern int sensorPin;
extern int sensorValue;

Then in MultiAnalogInput.ino I added:

#include "MultiAnalogInput.h"

In Analog2 I added:

 #include "MultiAnalogInput.h"

After this, the code compiled, loaded and ran without issue.

Cheers,

Jon

**Attention** This is a public forum