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

java

Firmata4j and a Simple DHT20 example

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 […]

VPL: testing arrays in Java with cloning

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

Main Project Example for EECS 1021

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 that are trivial to copy and, thus, reduce the effectiveness of the example as a learning tool. As such, I'm providing this example using […]

Unit testing for a project in Java

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

Driver for the Grove Beginner Kit for Arduino

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) click on the USB driver […]

VPL: A Java Unit Test Example

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 […]

Java and Arduino: Serial Communication

Java and Arduino: Serial Communication

Before we started using Firmata and Firmata4j in the EECS 1021 class, Richard Robinson and I put together lab activities that used the Fazecast jSerialComm library paired with customized Arduino serial code. The approach is summarized in three videos: Video 1: The Plan for Sending Data to an Arduino We need to send information, in […]

Java and Arduino (2022 edition)

Java and Arduino (2022 edition)

In the EECS 1021 class here at York University the students learning about object oriented programming in an engineering that uses sensors and actuators. We use Arduino devices that host a special pre-made firmware called Firmata to do this in order to unburden the students from the C++ coding that would otherwise be required on […]

Automated student testing in Java (Part 1)

Automated student testing in Java (Part 1)

As with earlier posts for Matlab, I'm putting together a set of exercises for automated student testing in introductory programming classes, but this time for Java. The idea is to integrate this into Virtual Programming Lab or secure lab tests. In a future post I'll do a VPL version of this, but for now this […]