[Solved] Accessing spark functions from C++ files

I have encapsulated a bunch of my code into a C++ file. However in this C++ file I can’t get access to some basic stuff like the millis() function. Are there some includes I can use to get access to this stuff? I can’t find any information online.


Can you please post your code?

Also how are you doing development? (WebIDE?)

You need to do

#include "application.h"

The name of this file is changing in an upcoming release to something with “Spark” in the name I believe. This is very similar to adding Arduino.h to access the wiring stuff on that platform.


Thanks! Does anyone know if there is a plan for a unit testing framework? The reason I ask is because I have a unit test which compiles my C++ class and runs some tests on it. Including the spark libraries breaks it obviously. I don’t think there is currently any way to get around that, but there also isn’t any current way to test my code without sending it to the Spark.

Harrison, I am working locally and compiling with the CLI. I am finding the Web IDE very lacking from a professional software engineer’s point of view.

Hi @osman

There is a unit test framework used for the core communication area and recently there has been a lot of refactoring work to introduce a hardware-abstract layer (not released yet, I believe) which will allow some very cool test methodologies to be used. So hang in there–there is a lot of great stuff for professional developers right around the corner.

Alright, I was just curious. It seems that @bko has answered you origin question I believe? I’ve marked the post as “solved.” if that’s not the case reply back and we’ll get this sorted out!

1 Like

Thanks. I wanted to mark it as solved but couldn’t figure out how.

1 Like