Using code on another machine, nothing happens

edited April 2016 in Arduino

I have developed some very basic code using Processing 3 to read a text file. If that text file has a certain value in it (in my example code I used the number 131) then the Processing 3 program sends a '1' to an Arduino board via serial connection. If the text file has a certain value that is anything else, send a '0' to an Arduino board.

I have this program working on my personal machine, which is an HP Pavilion dv7 laptop. When I tried to run the same code on a work laptop, a lenovo E420 ThinkPad Edge, the program won't run. I downloaded the same version of Processing 3 on both machines and simply copied the functioning code over to my work machine. I don't get any error messages. The program is designed to print a very simple message in the consol window depending on which signal is being sent to the Arduino. The consol window is blank when I run the program and the Arduino does not receive any communication.

I'm not sure where to even look at this point from a trouble shooting standpoint. Any help would be appreciated.

Here is the code. I'm aware the file location would be different on different machines so that's not the issue this time around.

import processing.serial.*; import java.io.*;

Serial myPort; // Create object from Serial class int[] data;

void setup() {

size(200,200); //make our canvas 200 x 200 pixels big String portName = Serial.list()[0]; //change the 0 to a 1 or 2 etc. to match your port myPort = new Serial(this, portName, 9600); }

void draw() { String[] stuff = loadStrings("File Location Goes Here"); String[] numbers = split(stuff[0],','); data = int(numbers);

if (data[0] == 131) { //if data in file reaches target mark myPort.write('1'); //send a 1 println("We're getting there!!!!!");
} else { //otherwise myPort.write('0'); //send a 0 println("We're STILL getting there!!!!!"); }
}

Tagged:

Answers

  • Answer ✓

    Maybe the serial port used by arduino is different on another laptop? Try ptinting Serial.list() to check that.

Sign In or Register to comment.