Hey guys! Great product. I am loving the easy connectivity to WiFi, especially being able to program over WiFi
I am an Arduino developer working with several clients who want the SparkCore to be the center of their prototype, and possibly even their final product. I navigated away from the traditional arduino development environment to the BareArduinoProject – check them out, they let you do all things arduino through the command line and using a traditional project structure (with src, lib, bin etc folders)
I think that this will be the way of the future for “serious Arduino developers”. Arduino is more and more becoming a tool in industry and profitable kickstarters – and people would like to have code completion etc with their favorite code editor (i.e. Eclipse, vim, etc), library management, git integration, and other features that coders are used to.
I am trying to implement a similar thing using the SparkCore. Looking at your documentation for the cli I thought this would be fairly easy by using spark.include files. This is intended to document some of my trials and some suggestions I have to make your CLI better.
Here is the code:
allduino.h (located in lib/allduino/allduino.h – allows you to compile for either Arduino or Sparkcore)
#ifndef __allduino_h
#define __allduino_h
// General include for all files.
// has some basic macros and includes proper arduino libraries
//
#ifdef SPARK
#include <application.h>
#elif (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#include <pins_arduino.h>
#endif
# Your analog values are different! I will be adding values like this in the future
#ifdef SPARK
#define ANALOGUE_MAX 4095
#define LED_PIN 7
#else
#define ANALOGUE_MAX 1023
#define LED_PIN 13
#endif
#endif
blink.cpp (in src/blink/blink.cpp)
#include <allduino.h>
void setup(){
pinMode(LED_PIN, OUTPUT);
}
void loop(){
digitalWrite(LED_PIN, HIGH);
delay(1000);
digitalWrite(LED_PIN, LOW);
delay(1000);
}
spark.include (also located in src/blink/spark.include)
../../lib/allduino/allduino.h
How I am compiling
I go to the src directory and type
spark compile blink
It works!
Suggestions
- The spark.include cannot list directories (i.e. …/…/lib/allduino will not work!) – this makes it much more difficult to develop libraries, as I will have to include each file name individually!
- spark compile from within the directory should compile the directory (i.e. compiling from within the blink directory should be the same as
spark compile ../blink
- There should be a way to set a variable in the spark.include file. i.e. I would like to set LIB_DIR to …/…/lib and then just do $(LIB_DIR)/allduino
Otherwise this is a great interface, and I am happy you have gotten command line tools at least functional so quickly! Great work, and keep it up!