Go Down

Topic: Problem sending live data to arduino using firmata (Read 756 times) previous topic - next topic

Sahoya

Apr 18, 2014, 05:37 am Last Edit: Apr 18, 2014, 05:40 am by Sahoya Reason: 1
I have five ellipses controlled by data driven from a string in my Processing file Called: "http://avail.mdx.ac.uk:8090/avail.js?".

The ellipses change size via map() function when the data in the string increases/decreases. I want to do the same for the LEDS. Hence, more LEDs turn on when more data is parsed through the serial communication and vice versa.

However, whenever I try I am greeted with this error 'java.lang.NullException.Pointer'

LED Set - Up:
5x5 vertical Grid (each row of leds controlled by each ellipse) - picture

- PDE file attached

- LED Set - Up attached


PaulS

Quote
However, whenever I try I am greeted with this error 'java.lang.NullException.Pointer'

There's more to the message than that.

Which port is the Arduino connected to?

How many ports are in this list?
Code: [Select]
Arduino.list()

Code: [Select]
String [] site = loadStrings(url);
How many strings are in this array?

Code: [Select]
String [] list = split(site[0], ';');
How many strings are in this array?

Code: [Select]
    String [] elm = list[i].split(":");
    String ID = elm[0];
    int total = int(elm[1]);
    int used = int(elm[2]);

How many strings are in elm?

Code: [Select]
{
  if (arduino.digitalRead(baFree) == Arduino.HIGH) {
    arduino.digitalWrite(LED1, Arduino.HIGH);
    int baVal=(int)map(baFree, 0, baMax, 5, 100);
  }
  else {
    arduino.digitalWrite(LED1, Arduino.LOW);
    ellipse(50, 50, 80, 80);
    fill(255);
  }

  text("Black - Free Computer Space", 260, 170);
  text("White - Used Computer Space", 260, 190);
}

What is this supposed to be doing? Code belongs in functions, not wherever you feel like putting it.

Sahoya

I have uploaded an updated version with no more error message, although still no LEDs turning on.

It is connected into Port 3. everything titled string all relates back to one string, which is "http://avail.mdx.ac.uk:8090/avail.js?"
.  (url) is a variable which relates back to that string, noticed on line 23. Everything else is just 'splitting' and 'listing' the same string.

I have attached a .fzz schematic for a greater understanding of the physical form and a new .pde, which should also help understanding of my problem.

Thanks,


PaulS

Code: [Select]
    if (ID.equals("var avail=\"HESLBAOA01")
    ) // on basement floor

Why
is
the
)
on
a
new
line?

Code: [Select]
{println("-----------------------------------");
WhyIStheprintln()statementNOTonanewline?

If you can't make the effort to make your code readable (how hard is it to use Ctrl-T?), I'm not going to make the effort to read it.

You didn't answer any of my questions.

Go Up