Graphing Code from TUtorial Not Working (IDE + Processing)

I'm on Arch Linux, using Arduino 1.6.5 and Processing 3.0b6
Using code from
I'm trying to graph the input from my Arduino DUE, with the following code:

Tools -> Boards : Arduino DUE (Programming Port)
Tools -> Port -> /dev/ttyACM0

Open Arduino IDE, paste this:

void setup() {
  // initialize the serial communication:

void loop() {
  // send the value of analog input 0:
  // wait a bit for the analog-to-digital converter
  // to stabilize after the last reading:

Chmod A+RW /dev/ttyAMC0

Open Processing, paste this:

import processing.serial.*;

Serial myPort;        // The serial port
int xPos = 1;         // horizontal position of the graph

void setup () {
// set the window size:
size(400, 300);

// List all the available serial ports
// I know that the first port in the serial list on my mac
// is always my  Arduino, so I open Serial.list()[0].
// Open whatever port is the one you're using.
myPort = new Serial(this, Serial.list()[0], 9600);
// don't generate a serialEvent() unless you get a newline character:
// set inital background:
void draw () {
// everything happens in the serialEvent()

void serialEvent (Serial myPort) {
// get the ASCII string:
String inString = myPort.readStringUntil('\n');

if (inString != null) {
// trim off any whitespace:
inString = trim(inString);
// convert to an int and map to the screen height:
float inByte = float(inString);
inByte = map(inByte, 0, 1023, 0, height);

// draw the line:
line(xPos, height, xPos, height - inByte);

// at the edge of the screen, go back to the beginning:
if (xPos >= width) {
xPos = 0;
else {
// increment the horizontal position:

Hit Run.

Problem: Console output

/dev/ttyACM0 /dev/ttyS0 /dev/ttyS1 /dev/ttyS2 /dev/ttyS3
map(NaN, 0, 1023, 0, 300) called, which returns NaN (not a number)

And a window with black background and nothing else appears.
Please help, the graph code won't work on Windows either.
Please check if my step has anything wrong with it.

Please note that I don't give input to A0 (A0 not wired), and the serial monitor still gives me a stream of random number 0-1023.

not connecting an input will leave it "floating".. you now can read random noise from it :wink: