Processing no compiles on Arduino UNO R3

hi I installed processing to make applications with arduino, but I’ve been trying to make a simple arduino program like Blink work for two days but nothing I state that with Arduino ide 2.03 it works well, but when I clear processing nothing, I state that it brings them" / dev/cu.usbmodem14701" I see it but when I compile the program for arduino uno nothing the BLINK program does not start. i use a hackintosh with catalina ver.10.15.7, any solution thanks

Hi Roberto, Welcome to the forum. I think you are a little confused by things.

To put a program (often referred to as a sketch), e.g. Blink, in your Arduino you need the Arduino IDE from the Arduino website. The language is C++.

Processing allows you to write Java programs to run on your PC.

Please note these and try not to be confused:

  • The Processing IDE and the Arduino IDE have developed from the same software. They look quite like each other

  • Java and C++ both developed from C and they are quite similar.

  • Many people use Processing to talk via serial to the program running in the Arduino. This is mostly what this section of the forum is about.

  • In the Processing Examples (File, Examples, Libraries, Serial) e.g. SimpleRead the Processing example contains the Arduino code as comment. You have to copy it out into the Arduino IDE and load it into the Arduino.

Hope this helps, please try things and ask again if you like.

2 Likes

I think I explained myself badly, the problem is that arduino writes in C and I know this, processing is a more simplified java and this also happens, my problem is that by writing an example with processing Exp. I run in processing but the arduino does absolutely nothing, instead running the Arduino ide and with his example of Blink everything works, in a few words running the arduno ide in the arduino and everything OK, instead run it with processing like the example does nothing.
Thank you
import cc.arduino.;
import processing.serial.
;

Serial serial;
Arduino arduino;

void setup() {
// println(serial.list());
println(Arduino.list());
String pname = Serial.list()[2];
print(pname);
// arduino = new Arduino(this,pname,57600);
arduino = new Arduino(this, Arduino.list()[2], 9600);

arduino.pinMode(9, Arduino.OUTPUT);
}

void draw()
{

arduino.digitalWrite(0, Arduino.HIGH);
delay(1000);

arduino.digitalWrite(9, Arduino.LOW);
delay(1000);
}

I think you are writing a Processing program that talks to the Arduino using the Arduino object.

This requires the program ‘Firmata’ to be running in the Arduino. Arduino IDE, File, Examples, Firmata, Standard Firmata. Compile, Load, wait for load to finish. Run Processing.

You will see there are lots of versions of Firmata. I’ve only used Firmata very briefly and don’t know what all the different versions are for.

You must have your Processing sketch stopped while you (compile and) load the Arduino.

no not only this also using the serial Exp. always the same thing
void setup() {
for (int i =0;i<Serial.list().length; i++) {
print(i + " ");
println(serial.list()[i]);
}

String pname = Serial.list()[5];
serial = new Serial(this,pname,9600);

}

void draw() {

if (serial.available() > 0 ) {
String val = serial.readStringUntil(‘\n’);
}
}
always the same thing

Try reading the data with serialEvent():

// Example by Tom Igoe 
 
import processing.serial.*; 
 
Serial myPort;    // The serial port
String inString;  // Input string from serial port
int lf = 10;      // ASCII linefeed 
 
void setup() { 
  size(400,200); 
  // List all the available serial ports: 
  printArray(Serial.list()); 
  myPort = new Serial(this, Serial.list()[3], 9600); 
  myPort.bufferUntil(lf); 
} 
 
void draw() { 
  background(0);
  textSize(24.0);
  text("received: " + inString, 10,50); 
} 
 
void serialEvent(Serial p) { 
  inString = p.readString(); 
}

Make sure that your Arduino is sending something:
Arduino code:

void setup() {
 Serial.begin(9600);
 Serial.println("Processing is great.");
}

void loop() {
}
1 Like

nothing received null

nothing received null

Did your arduino send anything? Arduino and Processing have to be paired. What one side is programmed to send, the other side has to be programmed to receive.

You mentioned testing the ‘blink’ example in Arduino. Try using this set of code, one set for the arduino to receive and light up a LED on your arduino board and the Processing app to repeatedly send a zero or a one: zero = turn LED off, one = turn LED on.

Processing send:

import processing.serial.*;

Serial myPort;

void setup() {
  // List all the available serial ports:
  printArray(Serial.list());
  // Open the port you are using at the rate you want:
  myPort = new Serial(this, Serial.list()[7], 9600);
}

void draw() {
  myPort.write(1); // turn on led
  delay(1000);
  myPort.write(0); // turn off led
  delay(1000);
}

Arduino receive:

int incomingByte = 0;   // for incoming serial data

void setup() {
  Serial.begin(9600);   // opens serial port, sets data rate to 9600 bps
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  delay(2500);
  if (Serial.available() > 0) {
    // read the incoming byte:
    incomingByte = Serial.read();
    switch (incomingByte) {
      case 0 : digitalWrite(LED_BUILTIN, LOW);
        break;
      case 1 : digitalWrite(LED_BUILTIN, HIGH);;
        break;  
      default: Serial.println("something else");
    }
}
}

[quote=“svan, post:8, topic:40721”]

import processing.serial.*;

Serial myPort;

void setup() {
  // List all the available serial ports:
  printArray(Serial.list());
  // Open the port you are using at the rate you want:
  myPort = new Serial(this, Serial.list()[7], 9600);
}

void draw() {
  myPort.write(1); // turn on led
  delay(1000);
  myPort.write(0); // turn off led
  delay(1000);
}

[/quotenothing no answer with your 2 examples, see you tomorrow I have to leave. Greetings and Thanks for your cooperation

Hi Svan, trying the two codes by loading the code in arduino and loading the code in processing and running it, it works, I think it’s signature of processing that doesn’t work, another alternative of signature for arduino operation without creating code with arduino IDE and but only with processing?
Greeting

Understood the functioning you had to first load the Firmata in arduino and then run processing with the signature library.
Greeting

Personally, I’ve never seen that done. If I understand correctly you want to blink an LED on an arduino board without programming it, using only Processing? If you post the code which fails we could try to help you further.

Thank you for your collaboration, but I understood to make arduino work you must first compile the program by inserting it esp"the library of firmabase.h" arduino and then with the serial or with the signature of processing run the code, I thought that processing could make it work Arduino directly without injecting the arduino code.
thank you

Arduino code is compiled by the Arduino editor. Processing code is compiled by the Processing editor. They are separate editors, and one won’t compile code for the other.

1 Like

One method of controlling the Arduino from a Processing program is to use the Arduino object in Processing. This talks to the program Firmata running in the Arduino. See my earlier post.

I made a simple example. You need to put the Arduino code in the Arduino. Adjust the serial port name in the Processing sketch, and I’m almost certain it will work.


There is a difficult problem that I found on Arduino Mega, and was the issue in this topic. The Arduino Serial was failing if it was sent a char when it wasn’t ready. I’ve only seen/heard of this on a Mega. I’m wondering if the Uno R3 has the same problem but I don’t have one to try.

When you start your Processing sketch, the Arduino resets. At that point have 500mS delay before sending to the Arduino. It think this will avoid the problem.

1 Like

Hi @roberto64
https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/all