Skip to content

Instantly share code, notes, and snippets.

/* Measures the speed of a ping pong ball using the distance
between two photoresistors and millis() */
int sensor1Value;
int sensor2Value;
double startTime;
double endTime;
double time;
double timeInSeconds;
double distance;
@MelissaBruno
MelissaBruno / Driver.java
Created March 17, 2016 00:00
A health tracker application in Java
import java.awt.EventQueue;
public class Driver {
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
@MelissaBruno
MelissaBruno / Blackjack.java
Created March 16, 2016 23:49
A game of blackjack in Java
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Scanner;
public class Blackjack {
@MelissaBruno
MelissaBruno / InvalidLengthException.java
Last active March 10, 2024 23:17
Create a playlist of songs in Java
public class InvalidLengthException extends Exception
{
private String lengthSent;
//Creates a blank InvalidLengthException with no arguements.
private InvalidLengthException()
{
}
@MelissaBruno
MelissaBruno / brunomr.m
Created March 16, 2016 23:36
Manipulating a digital signal in MATLAB
% Read .wav file
[recording,Fs] = audioread('recording.wav');
time = (1/Fs)*length(recording);
t = linspace(0, time, length(recording));
% Plots recording
normalplot = figure;
plot(t,recording);
xlabel('Time (seconds)');
ylabel('Amplitude');
@MelissaBruno
MelissaBruno / speed.ino
Created January 21, 2016 11:43
Measures the speed of a ping pong ball using two photoresistors.
/* Measures the speed of a ping pong ball using the distance
between two photoresistors and millis() */
int sensor1Value;
int sensor2Value;
double startTime;
double endTime;
double time;
double timeInSeconds;
double distance;