Skip to content

Instantly share code, notes, and snippets.

@clwillingham
clwillingham / mpl3115a.ino
Last active September 10, 2017 17:28
Barometer test
#include <Wire.h>
#include <Adafruit_MPL3115A2.h>
// Power by connecting Vin to 3-5V, GND to GND
// Uses I2C - connect SCL to the SCL pin, SDA to SDA pin
// See the Wire tutorial for pinouts for each Arduino
// http://arduino.cc/en/reference/wire
Adafruit_MPL3115A2 baro = Adafruit_MPL3115A2();
void setup() {
@clwillingham
clwillingham / basic-gp-v2.py
Last active July 6, 2017 03:43
Another Genetic Programming experiment. This one adds the input array directly into the evaluation rather than providing the individual values like the last one. This makes the algorithm much slower evolution, but could in theory handle more complex gym environments with some modifications
# This file uses DEAP (https://github.com/DEAP/deap)
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@clwillingham
clwillingham / basic-gp.py
Created July 4, 2017 22:34
OpenAI Experiment: Genetic Programming using DEAP
# This experiment is compatible with SCOOP.
# After installing scoop you can run the program with python -m scoop basic-gp.py
# This file uses DEAP (https://github.com/DEAP/deap)
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed in the hope that it will be useful,
#--- parameters for the XOR-2 experiment ---#
# The `Types` section specifies which classes should be used for various
# tasks in the NEAT algorithm. If you use a non-default class here, you
# must register it with your Config instance before loading the config file.
[Types]
stagnation_type = DefaultStagnation
reproduction_type = DefaultReproduction
[phenotype]
@clwillingham
clwillingham / main.py
Created December 5, 2016 03:14
Something NEAT
#dependencies
import gym
from neat import nn, population, statistics
import os
import visualize
# env = gym.make('CartPole-v0')
env = gym.make('CartPole-v1')
#I got lazy, change this before running a new experiment... or better yet write something to figure out what the next name should be!
monitor_path = './tmp/cartpole-experiment-14'
@clwillingham
clwillingham / garage_door_control.ino
Created September 8, 2015 02:40
Particle Core Garage Door Controller code
int garage_pin = D0;
int led_pin = D7;
bool door_enabled = true;
int setDoorEnabled(String data){
door_enabled = (data == "true");
Spark.publish("door_enabled_changed", ""+door_enabled);
}