I hope this exact issue was not addressed already. I did search for a while.
So I'm using the Arduino library for Processing, testing it by simply having it blink an LED that I have connected to my Arduino UNO. I'm following this tutorial, but am having a problem a little different than the ones covered on that tutorial page. Here's my Processing code:
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int ledPin = 13;
void setup()
{
//println(Arduino.list());
arduino = new Arduino(this, Arduino.list()[0], 57600); //error here
arduino.pinMode(ledPin, Arduino.OUTPUT);
}
void draw()
{
arduino.digitalWrite(ledPin, Arduino.HIGH);
delay(1000);
arduino.digitalWrite(ledPin, Arduino.LOW);
delay(1000);
}
Here's my error:
IllegalAccessError: tried to access class processing.core.PApplet$RegisteredMethods from class cc.arduino.Arduino$SerialProxy
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
Exception in thread "Animation Thread" java.lang.IllegalAccessError: tried to access class processing.core.PApplet$RegisteredMethods from class cc.arduino.Arduino$SerialProxy
at cc.arduino.Arduino$SerialProxy.<init>(Arduino.java:119)
at cc.arduino.Arduino.<init>(Arduino.java:168)
at sketch_130206a.setup(sketch_130206a.java:29)
at processing.core.PApplet.handleDraw(PApplet.java:2117)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:193)
at processing.core.PApplet.run(PApplet.java:2020)
at java.lang.Thread.run(Thread.java:680)
Since my error apparently has to do with access permissions, I tried doing what it says at the tutorial page I was following by going to /var/lock folder, but the /lock folder doesn't exist! I'm using a Mac 10.8.2. I searched around and found this thread (arduino dot cc/forum/index.php?topic=135164.0) and decided to try "sudo mkdir -p /var/lock" and "sudo chmod 777 /var/lock" in terminal, but it didn't change the error I have in Processing, even after restarting it. I also tried opening the Arduino app and uploading the StandardFirmata sketch as mentioned at the ProcessngxArduino library download page (playground.arduino dot cc/interfacing/processing) while trying to run the processing sketch, but same error. The fact that I'm using the Arduino UNO instead of the Duemilanove shouldn't be the issue as the UNO is apparently just an updated version of it. Any ideas what I could try to do next?
UPDATE: Okay so the highlighted error in my code is what opens the serial port I'm using at whatever rate (57600 bits/sec in this case I think). So I think the problem lies in this particular step in the instructions at the adrunio x processing info page mentioned earlier(playground dot arduino dot cc/interfacing/processing), step 3: "Configure Processing for serial: processing dot org/reference/libraries/serial/"... the link goes to processing's 'serial' reference page. I'm confused about what is meant by "configure"? How exactly do I figure out my "correct serial port"? I went through the rest of the instructions and the examples on the serial reference page, and still have no idea what I'm looking for.
UPDATE #2: My serial port for the arduino is "/dev/tty.usbmodem1411". I am still confused about how to plug this in to my code in Processing though. The things I just learned in these last 2 updates might be irrelevant to my error, I'm still unsure.
The problem was that I was using the beta version of Processing (2.0). Use the latest stable version (1.5.1) and it should work.
Related
I am having some issues with the Send Data with Sound Project on Arduino. I have my Arduino nano BLE sense, ChirpSDK by Asio Ltd Version 3.4.0 installed, I put in the CHIRP_APP_KEY, CHIRP_APP_SECRET, CHIRP_APP_CONFIG from the chirp website, and I also have the Arduino nano BLE board selected when uploading the code. But for some reason I keep getting this error below:
ChirpColor:22:10: error: chirp_connect.h: No such file or directory
#include "chirp_connect.h"
^~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
chirp_connect.h: No such file or directory
Any help would be very much appreciated, thanks.
The SDK functions have been renamed in the latest release. So connect is replaced with sdk.
With the latest version, you need to
#include "chirp_sdk.h"
See the latest header file for the function declarations - https://github.com/chirp/chirp-arduino/blob/develop/src/chirp_sdk.h
I am using an Raspberry Pi Zero with an L298n motor driver to control two motors. I was testing the motors using a Python script. That worked fine.
Now I wanted to use the Arduino software to program the motors. I was following this tutorial on how to archive that: https://www.youtube.com/watch?v=lZvhtfUlY8Y
Then I coded this into the Arduino software (v. 1.8.5)
void setup() {
// put your setup code here, to run once:
Console.println("Setup Einstellungen");
pinMode(17, OUTPUT);
delay(500);
Console.println("Setup Einstellungen Ende");
}
void loop() {
Console.println("Rechts Vorwärts");
digitalWrite(17, HIGH);
delay(1000);
digitalWrite(17, LOW);
delay(5000);
}
I compiled the file using "Export compiled Binary". I uploaded it on the Raspberry using FileZilla and tried to run it via SSH.
When I tried to run it with:
(sudo) sketch_feb28.ino.bplus.bin
I got the following error:
: -bash: syntax error near unexpected token `sketch_feb28.ino.bplus.bin'
Running file sketch_feb28.ino.bplus.bin
sketch_feb28a.ino.bplus.bin: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SY SV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2 .0, BuildID[sha1]=a0260345a3700dca64c63fde8a10959214ce9b85, not stripped
I cannot solve this issue alone.
I'm still not sure, where the syntax error comes from.
Run the file with:
./sketch_feb28.ino.bplus.bin
This is the syntax for running a binary, that is not in PATH. Since the file is a valid executable, the error message should vanish.
I have looked at a dozen different ways to reset my arduino, from connecting pins to the reset pin and jury rigging weird bits of code.
None of them work.
The one bit of code that everybody seems to be using is
void software_Reset() // Restarts program from beginning but does not reset the peripherals and registers
{
asm volatile (" jmp 0");
}
To which my arduino responds with
C:\Users\Leonardo\AppData\Local\Temp\ccGUYdTQ.s:2259: Error: bad
instruction `jmp 0'
And it then fails uploading the code. I don't know what to do. My full code can be found here http://pastebin.com/CA2Ms2hB but it's huge and I'm not sure if it will be of help.
If anyone could help me understand why software_Reset(); I would really appreciate it, I'm at the end of my rope here.
(also if you have other methods to reset arduino I'll gladly try them)
On ARM based microcontrollers you can call NVIC_SystemReset().
All ARM based microcontrollers are required to implement that.
This is useful because resetFunc() at address 0 may not work on newer ARM based microcontrollers.
I think you are trying to write assembly code in your arduino code editor.
Let me tell you one thing. Arduino code editor does not support assembly language code by default. You can write assembly language code in arduino code editor by going through the process mentioned below:
Caution: We will be modifying the arduino source code to do that.
Get the source code for Arduino IDE: https://github.com/arduino/arduino
Extract the downloaded zip file, you will get a folder named Arduino-master
Open the Sketch.java file in a text editor of your choice. The location of sketch.java is : Arduino-master/app/src/processing/app/Sketch.java
Insert the .s capability:
a. Search for: sc.isExtension("c");
you will see something like this:
//3. then loop over the code[] and save each .java file
for (SketchCode sc : code){
if(sc.isExtension("c") || sc.isExtension("cpp") || sc.isExtension("h")){
//no pre-processing services necessary for java files
b. Add sc.isExtension("s") at the end of the if condition. Now your code should look like below:
//3. then loop over the code[] and save each .java file
for (SketchCode sc : code){
if(sc.isExtension("c") || sc.isExtension("cpp") || sc.isExtension("h") || sc.isExtension("s")){
//no pre-processing services necessary for java files
Search for: String[] getExtensions()
You will see some code like this:
/**
* Returns a String[] array of proper extensions.
*/
public String[] getExtensions() {
return new String[] { "ino", "pde", "c", "cpp", "h" };
}
Insert "s" in the returned Array. So, now your code should look like this:
/**
* Returns a String[] array of proper extensions.
*/
public String[] getExtensions() {
return new String[] { "ino", "pde", "c", "cpp", "h", "s" };
}
Save Sketch.java
Open Compiler.java in text editor of your choice. The location of Compiler.java is: Arduino-master/app/src/processing/app/debug/Compiler.java
Search for: compileFiles(
In the command findFilesInFolder(), replace the capital S with a lowercase s.
Repeat step 8 : 3 times more... (4 tiems in total)
Save the Compiler.java file
Download the latest version of java SE 8u111 from http://www.oracle.com
Download and install any java command line tool. But I would recommend Apache ANT.
If you are a windows user:
You can download it here: http://ant.apache.org/
More help on download and install on windows: https://www.mkyong.com/ant/how-to-install-apache-ant-on-windows/
If you are a Mac user:
You need to install it using Homwbrew:
To install Homebrew:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
And then to install Apache ANT:
brew install ant
In Command line go to the directory for Arduino-master/build
Build the Arduino IDE using : ant build, which should end with Build Successful message.
Package the Arduino IDE using: ant dist
It will ask you to enter a version number and give a suggestion e.g.[0105]. Just enter the suggested number with dots and asm. For example: If suggestion is [0105] then enter: 1.0.5.asm
This command may take 6 - 10 minutes to finish. (depending on the speed of your computer)
Then you must get Build Successful!!!
The Arduino IDE that supports assembly language programming can be found in the newly created .zip file
Unzip the file and install the Arduino IDE application.
Now, you should be able to write assembly programs without getting errors in the Arduino IDE.
If you have any problems, Please feel free to ask.
I am using the StandardFirmata on a new Yun.
https://gist.githubusercontent.com/edgarsilva/e73c15a019396d6aaef2/raw/b00e100f1551d87e30f49e5ac98517370e699ee2/StandardFirmataForATH0.ino
Everything works great while I am in Linux.
But as soon as I reboot, the Yun linux will not come up (seems like networking doesn't come up).
I am using the latest Yun build.
UT, the problem is that after a reboot, the device will not boot Linux (maybe Linux interfaces are down).
for whatever reason, these lines are causing the problem:
Serial1.begin(57600); // Set the baud.
Firmata.begin(Serial1);
but if I do it like the original file:
Firmata.begin(57600);
the Linux works fine on boot, but I can't get Firmata to work if I take that line...
so it's a catch 22..
PLEASE HELP, I have already worked on this for 2 days and can't find a solution on google,
Thanks for reading,
Sean.
FIXED:
yes I had the same issue..
using node.js and Firmata.
FIXED:
in /usr/lib/node_modules/firmata/lib/firmata.js edit the line
if(typeof port === 'object'){
this.sp = port;
} else {
this.sp = new SerialPort(port, {
baudrate: XXXX,
buffersize: 1
});
}
and set XXXX to be 9600
and in StandardFirmata set the same:
Serial1.begin(9600); // Set the baud.
now Node.js speaks to Firmata no problem!!!!!!!
hope this helps someone get their Arduino Yun to speak to Firmata / Cyclon.js
I am using Arduino and NetBeans in my project. My final work is to switch from Arduino program to Java. I managed to install an Arduino-NetBeans plugin as described in Arduino - NetBeans Plugin detail
My Arduino program includes
Serial.begin(9600); /////// Serial.print();
I get an error saying that "Unable to resolve identifier Serial". How can I solve this?
this is what you have to add to your source file:
#include <Arduino.h>
// imports the Serial class to allow log output
extern HardwareSerial Serial;
then it will work.
As answered by cgo you can add extern HardwareSerial Serial;
Or into your Project Settings, go to BUILD > C++ COMPILER > PREPROCESSOR DEFINITIONS and add: __AVR_ATmega328P__ (if you are working with Arduino UNO)
The message "unable to resolve identifier Serial" means that the compiler is searching for the variable Serial, but cannot find its declaration. You should check if you include all header files properly. I don't know the NetBeans plugin, but I guess the Serial-structure/class is initialised there.
If that is not helping, you should check the compiler otions and set them to default, as described on the project-site.