[Java] Download File from URL

In your program, you might want to¬†acquire¬†files from the internet for purposes such as update, additional resources, web image gallery… so here’s a modified version of the codes I found on stackoverflow.com that you can just copy and paste into your Java program. Just supply the URL for path and the file name in filename.

 public static String downloadFile(String path, String filename)
 {


 try {
 URL website = new URL(path);
 ReadableByteChannel rbc = Channels.newChannel(website.openStream());
 FileOutputStream fos = new FileOutputStream(filename);
 fos.getChannel().transferFrom(rbc, 0, 1 << 24);
 } catch (IOException ex) {
 Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
 }

 return path + "............ COMPLETED!";


 }

[Arduino] Arduino to Arduino Serial Communication

In this post, we will explore an easy method for transferring data from one Arduino board to another using Bill Porter’s EasyTransfer Library. Here’s a traditional method on how you hook up Arduino’s serial ports. TX to RX, RX to TX, Ground to Ground. TX is the transfer pin and RX is the receiver pin, therefore you connect the one to the other. Finally, in order for the two device to communicate with each other, the two boards must have a common ground. Here’s the wiring I drew using Fritzing, I figured it’s probably time to be neater in describing how to hook stuffs up, lol.

Library Download Link:
http://www.billporter.info/easytransfer-arduino-library/

Continue reading