Skip to content

Instantly share code, notes, and snippets.

View AnimateBilly.h
#include <AFMotor.h>
#define NUM_MOTORS 3
AF_DCMotor head(1, MOTOR12_1KHZ); // create motor #2, 64KHz pwm
AF_DCMotor mouth(2, MOTOR12_1KHZ);
AF_DCMotor tail(3, MOTOR34_1KHZ);
void runMotorOnOff(AF_DCMotor motor, int aniDelay = 500){
motor.run(FORWARD);
@benrules2
benrules2 / AudioDiagnostic.ino
Created Jan 24, 2019
Billy Bass Audio Diagnostic
View AudioDiagnostic.ino
int sensorPin = A0; // select the input pin for the audio signal input
int ledPin = 13;
void setup() {
// declare the ledPin as an OUTPUT and sensorPin as input
pinMode(ledPin, OUTPUT);
pinMode(sensorPin, INPUT);
Serial.begin(9600); // open the serial port at 9600 bps:
}
@benrules2
benrules2 / MotorDiagnostic.ino
Created Jan 24, 2019
Billy Bass Motor Diagnostic
View MotorDiagnostic.ino
#include <AFMotor.h>
#define NUM_MOTORS 3
AF_DCMotor head(1, MOTOR12_1KHZ);
AF_DCMotor mouth(2, MOTOR12_1KHZ);
AF_DCMotor tail(3, MOTOR34_1KHZ);
AF_DCMotor motors[NUM_MOTORS] = {head, mouth, tail};
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
View shift_youtube.py
import sys
alphabet = ["a", "b", "c", "d","e","f","g","h", "i", "j",
"k", "l", "m", "n","o","p", "q", "r","s", "t",
"u", "v", "w", "x", "y", "z"]
class ShiftCipher:
def __init__(self, N = 13):
self.cipher_alphabet = alphabet[N:]
self.cipher_alphabet.extend(alphabet[0:N])
View shift.py
class ShiftCipher:
def __init__(self, N = 13):
self.original_alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m",
"n","o","p","q","r","s","t","u","v","w","x","y","z"]
self.cipher_alphabet = self.original_alphabet[N:]
self.cipher_alphabet.extend(self.original_alphabet[0:N])
def encrypt_message(self, message):
encrypted = ""
#lowercase the message as alphabets are lowercase
@benrules2
benrules2 / shift_3.py
Last active Sep 27, 2018
Shift Cipher
View shift_3.py
class ShiftCipher:
[...]
import sys
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Not enough arguments, please provide e/d followed by the message")
N = 13
cipher = ShiftCipher(N)
@benrules2
benrules2 / shift_2.py
Last active Sep 27, 2018
Shift Cipher
View shift_2.py
class ShiftCipher:
def __init__(self, N = 13):
[...]
def encrypt_message(self, message):
encrypted = ""
#lowercase the message as alphabets are lowercase
message = message.lower()
for letter in message:
if self.original_alphabet.count(letter) > 0:
@benrules2
benrules2 / shift_1.py
Last active Sep 27, 2018
Shift Cipher
View shift_1.py
class ShiftCipher:
def __init__(self, N = 13):
self.original_alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m",
"n","o","p","q","r","s","t","u","v","w","x","y","z"]
self.cipher_alphabet = self.original_alphabet[N:]
self.cipher_alphabet.extend(self.original_alphabet[0:N])
@benrules2
benrules2 / fire.ino
Created Dec 11, 2017
Arduino Fireplace Code
View fire.ino
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
@benrules2
benrules2 / ThingShadow.ino
Last active Nov 13, 2018
Alexa Smart Home and Arduino Yun Smart Light Code
View ThingShadow.ino
/*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
You can’t perform that action at this time.