

Public class SerialCom implements SerialPortEventListener įor (int i=0 i Copy all the files in your Arduino / lib folder and put them here. Once that was ready, right click on your projects->properties->libraries->Add folder/jar files. I worked on Netbeans on 圆4 pc and had to get the 32 one. If you are using a 圆4 bit computer, then you might have to download the x86 JDK. Follow the method explained on their website. To enable serial communication over COM ports, this library is a must. Now to the main thing – Java code alongwith RXTX Libraries. Once the sketch was ready, simply upload it on the UNO. If(val = 1) //Switch on the LED, if the received value is 1.Įlse if(val = 0) //Switch off the LED, if the received value is 1. Void serialEvent() // To check if there is any data on the Serial line To begin with, here’s the sketch for Arduino UNO: A big thanks to the Arduino forum that helped me get this one. After fidgeting with things like “ su ln /dev/ttyACM0 dev/ttyUSB0, uccp -aG dialout user, RFFile locks.” I thought to move to my Windows machine.įew clicks here and there plus fresh installation of JDK x86 ( due to a problem with RXTXserial files for 圆4 + Netbeans), it was all ready in less that 3 hours !! Truly amazing !! Windows doing stuff that my Ubuntu couldn’t managed to rather was too complex. My God, the first time I did something and I remember that the TX LED was on and nothing was happening, thought it was all over, but finally managed to get over it. ( Always prefer programming on a Linux based PC as it’s easy and things are straight forward – I think so ! :P) Things were fine until I tried serial communication. Initially was working on my Ubuntu machine along with the UNO. But even then, the only thing I wanted to achieve was to be able to send and receive data from the Arduino and PC and vice versa. This took me over 4 days to understand(Mind you – haven’t understood it completely yet !!) This guide will help you to communicate with your Arduino Board using Java and RXTX library. Started by simple LED ON/OFF tutorials, then moved to playing around with sensors – temperature, motion, photo resistors etc. From the I had purchased the Arduino Uno, I was busy tinkering with it day in and day out.