/* jquery */ /* jquery accordion style*/ /* jquery init */
Showing posts with label BlueJ. Show all posts
Showing posts with label BlueJ. Show all posts

Coding with Raspbian Jessie

Python

Right from the beginning Python has been the primary development language of the Raspberry Pi.

Install the latest Raspbian Jessie distribution image and you'll find both Python version 3 and the older version 2.7. Both versions come with plenty of source code examples.

Scratch

With Scratch, from MIT's innovative Media Lab, you can construct all kinds of multimedia projects without writing a single line of code. Scratch's highly visual interface is based around graphical, snap-together programming blocks and aimed at anyone old enough to use a keyboard and mouse.

On Jessie there's a built-in GPIO server, which simplifies GPIO pins access. Look at little closer and you'll discover this server also delivers direct access to the Pi's built-in camera interface and network IP addressing.

Parents and teachers might like to go to the ScratchEd online community where they can share stories, exchange resources and ask questions.

Java

With the Jessie image Java fans have two new applications in the main menu's Programming category.

Called BlueJ and Greenfoot they simplify the app building experience with a graphical coding environment that mixes mouse-driven design and code generation with traditional hand-coded statements.

C

Just like any other Linux-based operating system Raspbian's kernel code, device drivers, tools, utilities and graphical desktop are all written using the C language. However, learning a compiled language like C is a little more challenging.

The simplest way to begin is to play around with the pre-installed sample C programs. You'll find graphics, audio and video source code files, associated compilation 'make' files and a couple of helper C libraries in the directory /opt/vc/src/hello_pi.

Node-RED

Node-RED aims to deliver an easy-to-use development tool for Internet-of-Things (IoT) devices, including the Raspberry Pi. Created by IBM it's a browser-based tool built on top of Node.js, a popular free-to-install JavaScript server.

The user interface has a drag-and-drop flow editor, where you wire together combinations of blocks selected from a palette. Once constructed flows can be executed with a single click. Node-RED example flows include GPIO and camera interaction, web services, social media and Pi Minecraft communication.

Sonic Pi

With Sonic Pi you can compose your own unique musical compositions. It was created by Sam Aaron at the University of Cambridge, who hosts live, code-generated musical performances.

The Sonic Pi scripting language is designed around a set of simple, music-centric commands. The syntax will look familiar to those with experience of scripting languages like Python, although it's based on another popular programming language called Ruby.

Code Editors

There are a number of code editors pre-installed on Raspbian Jessie. Some are straightforward Linux text editor stalwarts like Vim and Nano.

Others, like Python's IDLE and the general purpose Geany, understand code syntax and so feature colour-coded listings, auto-completion, debugging support and general coding assistance. Geany supports many other languages including C, Java, HTML, XML and PHP.

More Raspberry Pi Coding, Tips and Tricks

More Raspberry Pi Java 8 and BlueJ 3.14

In the latest Oracle Java Magazine there's part 2 of Code Java on the Raspberry Pi by Michael Kolling which describes how to install, run and code with BlueJ version 3.14 on the Raspberry Pi.

And remember, this version of BlueJ includes the Pi4J library for direct access to the Raspberry Pi's hardware.

More Raspberry Pi Coding, Tips and Tricks

Java 8 and BlueJ 3.14 on a Raspberry Pi

In late 2013 Oracle released a Java language development kit (JDK) optimized for the Raspberry Pi's platform..

A short time later the Raspberry Pi Foundation included Oracle’s JDK by default in its Raspbian OS image.

However, running a coder-friendly Java editor, like the BlueJ IDE, on the Raspberry Pi was still a problem.

The good news it that in a recent Java Magazine article Michael Kolling describes how to install and run BlueJ version 3.14 on the Raspberry Pi.

Even better, this version of BlueJ also includes the Pi4J library for direct access to the Raspberry Pi's hardware.

Minecraft Pi Edition's main 'pi' package in BlueJ

More Raspberry Pi Coding, Tips and Tricks

Raspberry Pi Minecraft with BlueJ

Mojang created a special Raspberry Pi version of Minecraft specifically to encourage game hacking. This free version of the game includes Python and Java API's.

The API and Demo packages contain numerous classes. But what's a good tool for navigating the code?

Well, a visual way to begin Minecraft hacking in Java is with the BlueJ editor.

A recent Michael Kolling's Oracle Java Magazine article demonstrates how to install and run the Pi-friendly BlueJ 3.14 on your Raspberry Pi.

Open the API root source file folder as a Non-BlueJ Project. Now you'll have a class diagram for each package and a syntax-highlighting editor to browse the code. You can do the same for the Demo source code.

The images below give a flavour of how it will look.

The main 'pi' package:

The pi.event package:

The pi.demo package:

Source code for the LowLevelDemo class:

Javadoc for the Log class:

More Raspberry Pi Coding, Tips and Tricks

Raspberry Pi BlueJ Learning Videos

Are you just starting to code with the Java language and looking for a little help?

As I discussed previously the BlueJ editor is a great tool for beginners.

Recently I noticed object first with java, a comprehensive collection of videos which walk you through the basics of Java development with the BlueJ editor.

At the time of this post there's twelve in the collection.

More Raspberry Pi Coding, Tips and Tricks

Raspberry Pi Java with BlueJ

So the Raspberry Pi has a new performance-enhanced port of Oracle Java programming language.

But some of the traditional Java IDEs like Eclipse and Netbeans are large, memory-hogging applications. Is there a more Pi-friendly alternative?

The BlueJ Java programming environment aims to teach the fundamentals of object orientation (OO) design. While similar in concept to the closely related Greenfoot project BlueJ is targeted at students or anyone wishing to explore modern programming concepts through experimentation.

A graphical programming interface helps to visualise the high-level OO design, as opposed to just diving into the code. Behind the scenes there a full source code editor with built-in compiler, syntax-highlighting, scope-visualisation and auto-completion, plus an interactive testing mode.

It's an ideal solution when working with an unfamiliar set of Java classes, such as Mojang's Minecraft API for the Pi.

A recent Michael Kolling's Oracle Java Magazine article demonstrates how to install and run the Pi-friendly BlueJ 3.14 on your Raspberry Pi.

Alternatively, if your Pi is running the Raspbian image the BlueJ website has a Debian-specific .deb file download. After downloading move to the download directory, then execute this command in a terminal window:

$ dpkg -i bluej-314.deb

Below is a screenshot of BlueJ in action:

More Raspberry Pi Coding, Tips and Tricks