Example
Blink.ino
#include "Ardnodeo.h"#define LED_PIN 13 Ardnodeo node; void setup() { node.setup();} void loop() { node.loop();}
Blink.js
var Ardnodeo = ; // Automatically load your Arduino preferences and connect to the device.var arduino = Ardnodeo; // Load the sketch.arduinosource'Blink.ino'; // Since we already defined LED_PIN in the sketch, no need to define it again.var ledPin = arduinodefineLED_PIN; // Blink the LED every second.var ledState = false;;
Shared Variables
Ardnodeo can recognize variables from a sketch and share them remotely.
This example is a cut down version of the FastLED Example
Sketch.ino
#define NUM_LEDS 90#define KERNAL_SIZE 5 struct data_t { signed short ledSpeed; signed char ledConvolution[KERNAL_SIZE]; CRGB ledBuffer[NUM_LEDS];} data; ArdnodeoData<data_t> ard = ArdnodeoData<data_t>( &data ); // etc...
Javascript
// Load the sketch's source code. Magic happens here. arduinosource'Sketch.ino'; // Definitions are loaded.arduinodefineNUM_LEDS == 90; // Setting variablesarduinovarsledSpeedvalue = -200; // Setting an array index.// Equivalent to ledConvolution[1] = 10;arduinovarsledConvolution; // Recognizes FastLED's CRGB class and recognizes colours.arduinovars;