Sunday, June 23, 2013

Setup RxTx for Arduino and Java example

Refer to the post "Arduino and Java", Arduino Playground provide a example of Java code work with Arduino with RxTx library. I will create it work in Netbeans in next post, "Create Java project using librxtx-java in Netbeans, work with Arduino".

In Arduino side, you can 100% copy the provided sample and download to Arduino board, tested on Arduino Due.

List here:
void setup(){
  Serial.begin(9600);
}

void loop(){
  Serial.println("Hello world");
  delay(1000);
}


In PC side, you have to install librxtx-java, setup JAR in Netbeans, and copy librxtxSerial.so to your java library path. Refer to the post of "Install RXTX on Ubuntu" and "Setup RxTx jar and .so for Ubuntu".

The steps to build java program with NetBeans will be in next post. Finally, it will run as shown below.

running


Next:
- Create Java project using librxtx-java in Netbeans, work with Arduino
- Communication between Arduino and PC running Java, with JavaFX UI


No comments:

Post a Comment