Skip to content

Instantly share code, notes, and snippets.

const int ledPin = 13; // LED connected to digital pin 13
const int knockSensor = A0; // the piezo is connected to analog pin 0
const int threshold = 250; // threshold value to decide when the detected sound is a knock or not
// these variables will change:
int sensorReading = 0; // variable to store the value read from the sensor pin
int ledState = LOW; // variable used to store the last LED status, to toggle the light
void setup() {
import java.util.*;
public class BinaryConvert
{
Scanner sc = new Scanner(System.in);
public BinaryConvert(){
System.out.println("Press 1 to convert decimal to binary, press 2 to do the opposite.");
int which = sc.nextInt();
import java.util.*;
public class CaesarCipher
{
String message;
int key;
Scanner sc = new Scanner(System.in);
String encoded = "";
import java.util.*;
public class CaesarCipher
{
String message;
int key;
Scanner sc = new Scanner(System.in);
String encoded = "";
@landjd19
landjd19 / gist:57e0cbbf307a9d6aecfcf60bd88e1cc5
Created January 7, 2019 17:10
Selection Sort on 10 Primes
public class intSort
{
public intSort(){
int[] primes = new int[10];
for(int i=0;i<=9;i++){
int newNum = (int)((Math.random() * 1000) + 1);
if(isAPrime(newNum)){
primes[i] = newNum;
}else{
i--;
char letter;
String sym = "";
String words = "";
String lines = "";
float linePlace = -150;
ArrayList<String> priceList = new ArrayList<String>();
String placeHolder = "";
int spot = 0;
int which = 0;
//In draw method
/**
* Write a description of class RandomOrder here.
*
* @author (jake landaiche)
* @version (a version number or a date)
*/
import java.util.*;
public class RandomOrder
/**
* A program to carry on conversations with a human user.
* This is the initial version that:
* <ul><li>
* Uses indexOf to find strings
* </li><li>
* Handles responding to simple words and phrases
* </li></ul>
* This version uses a nested if to handle default responses.
* @author Jake Landaiche
/**
* Write a description of class FactorialRunner here.
*
* @author Jake Landaiche
* @version 10/10/18
*/
import java.util.*;
public class FactorialRunner
{
/**
* Write a description of class Factorial here.
*
* @author jake Landaiche
* @version 10/10/18
*/
import java.util.*;