Pages: [1]   Go Down
Author Topic: Problem sending live data to arduino using firmata  (Read 544 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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



* 20140416_152545 (1).jpg (2022.23 KB, 3264x2448 - viewed 14 times.)

* LED Grid.jpg (1859.74 KB, 3264x2448 - viewed 14 times.)
* Led_Ellipse_Test.pde (2.16 KB - downloaded 6 times.)
« Last Edit: April 17, 2014, 10:40:36 pm by Sahoya » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Arduino.list()

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

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

Code:
    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:
{
  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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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,


* Led_Ellipse_Error2.pde (2.13 KB - downloaded 5 times.)
* Fritzing 5x5 grid.fzz (8.21 KB - downloaded 5 times.)
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
    if (ID.equals("var avail=\"HESLBAOA01")
    ) // on basement floor
Why
is
the
)
on
a
new
line?

Code:
{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.
Logged

Pages: [1]   Go Up
Jump to: