Programming Arduino board with Processing

I have some Neopixels that I’m using to display large reams of data in sequence, too much to feasibly load into the Arduino directly. I’ve never written code in Processing before, but I’ve gotten Arduino and Processing to connect over the serial port just fine and loaded the data with Processing just fine too. It seems unlikely that I can just send the data from Processing to Arduino in any reasonable capacity, but can I? I’m working with arrays of arrays of structs.

Alternatively it seems like I can just use the Arduino library in Processing and compile the code on my pc and then send it to the Arduino, but my code relies on a few outside libraries (Neopixel, etc.). How can I load Arduino libraries onto Processing? It doesn’t seem like I can just drop the .h files into the sketchbook libraries folder, so…

Here’s my Arduino code in progress:

#include <ArduinoJson.h>

#include <Adafruit_NeoPixel.h>
#include <avr/power.h>

#define PIN 6

Adafruit_NeoPixel strip = Adafruit_NeoPixel(148, PIN, NEO_GRB + NEO_KHZ800);

void setup() 
    strip.begin();; // Initialize all pixels to 'off'


struct SensorHit
  double dom;
  double string;
  double width;
  double color;
  double brightness;

double dom_1 = 23;
double string_1 = 3;
double width_1 = 1;
double color_1 = 4169.60363111;
double brightness_1 = 0.8202955148;

double dom_2 = 26;
double string_2 = 0;
double width_2 = 2;
double color_2 = 8034.12044970;
double brightness_2 = 2.2433996144;

double dom_3 = 16;
double string_3 = 0;
double width_3 = 16;
double color_3 = 11339.65604992;
double brightness_3 = 0.5867384242;

double dom_4 = 6;
double string_4 = 3;
double width_4 = 2;
double color_4 = 12214.59009801;
double brightness_4 = 0.5923392655;

void loop() {

//double hit_1[5];
//double hit_2[5];

struct SensorHit hit_1 = {dom_1, string_1, width_1, color_1, brightness_1};
struct SensorHit hit_2 = {dom_2, string_2, width_2, color_2, brightness_2};
struct SensorHit hit_3 = {dom_3, string_3, width_3, color_3, brightness_3};
struct SensorHit hit_4 = {dom_4, string_4, width_4, color_4, brightness_4};

struct SensorHit Event_1[4] = {hit_1, hit_2, hit_3, hit_4}; //initializes array of size 4

struct SensorHit Event_2[4] = {hit_4,hit_3,hit_2,hit_1};

int num_hits = sizeof(Event_1)/sizeof(Event_1[0]);




void setEvent(struct SensorHit Event[], int num_hits)

struct SensorHit current_hit = Event[0]; //first hit to be displayed

int n = 0;

while (n < num_hits ){
  struct SensorHit current_hit = Event[n];
  strip.setPixelColor(current_hit.string * 30 + current_hit.dom, Wheel((current_hit.color - 4000)/50), 20*log(85*current_hit.brightness));;


void dimEvent(struct SensorHit Event[], int num_hits)

struct SensorHit current_hit = Event[0]; 

int n = 0;

while (n < num_hits){
  struct SensorHit current_hit = Event[n];
      strip.setPixelColor(current_hit.string * 30 + current_hit.dom,0);;

uint32_t Wheel(byte WheelPos) 
    WheelPos =  255 - WheelPos;
  if(WheelPos < 85)
        return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
    else if(WheelPos < 170)
      WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
      WheelPos -= 170;
    return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);

You can’t program an Arduino using Processing, and even if you could you would still have the data limitations that you have with the Arduino IDE.

You can certainly send data to the Arduino from Processing and from most other PC programming languages.

You just need to devise a system for the Arduino to receive data and apply it where it is needed. The examples in Serial Input Basics (especially the 3rd one) should give you some ideas.

I am not familiar with Processing. This Python - Arduino demo may be of interest.


How can I load Arduino libraries onto Processing?

You can't. What you are talking about is turning the Arduino into an idiot, capable of reacting only to pin change/ pin read directives. You would need to completely rewrite the C++ code in Java to be able to use it with Processing.

If your idea is to use Processing to send the data to the neoliberal then you can't. This is because that data has to be inside the Arduino already for the transfer to the neopixels this is because there are very tight timing requirements and you will not be able to transfer it to the Arduino fast enough to load into the display.