Skip to main content Skip to local navigation
Home » Category: 'java'

java

Basic Graphics and Graphs with Princeton's Java StdLib

I really like the Princeton StdLib for Java to make basic graphs with Java. The learning curve isn't steep and installation is easy. To get started either grab the Maven support files or the JAR and install in IntelliJ or your favourite IDE. Here's an example to draw some basic shapes on the screen. Now, […]

Version 2.3.9 of Firmata4j

When using Maven to load the Firmata4j library you'll be required to use version 2.3.8 and you'll need to load dependencies in a particular order, as per my earlier blog page. It's manageable but a little cumbersome. That said, most students can handle it. Instead, you can try to use version 2.3.9. I've loaded the […]

Plagiarism detection for program source code

Detecting copied source code in student assignments is important. Here, I'll explore a few options that are possible for instructors here at York University, but these options may also work for instructors elsewhere. Look, there are a few notable reasons why copied source code will appear in a student's assignment: Given the convenience of the […]

Firmata4j and a Simple DHT20 example

After my earlier blog post from today, I wanted to verify that I could read single bytes of data from other sensors on the Grove Beginner Kit for Arduino. The next target? The DHT20 sensor. According to the data sheet, I should be able to be able to request a status byte and that that […]

Firmata Example : I2C Sensor + Java & Firmata4j

A lot of Arduino projects are meant to always be attached to a PC, transferring data back and forth between the Arduino and the PC. That's why Firmata, a program that sits on the Arduino and allows a program on your PC to remotely read from sensors and buttons and transmit to things like speakers […]

VPL: testing arrays in Java with cloning

On a recent final exam I had students create a method that could interleave two halves of an array. The original exercise came from a Schaum's Outline book. If you're not careful, by passing values by reference you can have the student's solution pollute the original input test value. To solve this in Java you […]

Main Project Example for EECS 1021

[This was written specifically for the 2024 edition of the course. Some details may have changed. Please refer to current documentation provided in class. The following is an example of a main project for the EECS 1021 course. While I think that it's important to provide concrete examples it's also important not to provide examples […]

Unit testing for a project in Java

It's important to create test frameworks for your programs. In Java we use the jUnit system to do so. Here is an example of setting up a unit tester to make sure that that a method returns the values it's supposed to. First, let's look at the method. I'm using it to convert values that […]

Driver for the Grove Beginner Kit for Arduino (updated 2024)

[updated for Windows ARM users] For students attempting to get the USB drivers working for the Grove Beginner Kit for Arduino please follow these instructions: First: make sure that you're not using the white USB cable.  Use a different one. Second: install the USB driver for the board. a) Go to Seeed Studio's wiki: https://wiki.seeedstudio.com/Grove-Beginner-Kit-For-Arduino/ b) […]

VPL: A Java Unit Test Example

The following is an example of the files needed to create a working Virtual Programming Lab exercise for Java: vpl_run.sh vpl_evaluate.sh MainClass.java StudentSolution.java TeacherReferenceSolutions.java TheTestClass.java With this you can evaluate one student submission against a single reference solution. Two methods are run: one is the student's method and one is the teacher's method. The output […]