Skip to content

Instantly share code, notes, and snippets.

#include <CapacitiveSensor.h>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define neoPin 7
#define trigPin 13
#define echoPin 12
const int switchPin = 8; // switch input
const int motor1Pin = 3; // H-bridge leg 1 (pin 2, 1A)
const int motor2Pin = 4; // H-bridge leg 2 (pin 7, 2A)
const int enablePin = 9; // H-bridge enable pin
int switchState = 0;
void setup() {
Serial.begin(9600);
pinMode(switchPin, INPUT);
#include <Servo.h>
//make an instance of the servo library
Servo myServo;
void setup() {
attach the servo motor
myServo.attach(9);
Serial.begin(9600);
}
int dirPin = 3;
int stepPin = 2;
int switchPin = 8;
int switchState = 0;
void setup(){
pinMode(dirPin, OUTPUT);
pinMode(stepPin, OUTPUT);
pinMode(switchPin,INPUT);
int pot=0;
int slider=0;
int incoming;
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#include <CapacitiveSensor.h>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define neoPin A2
#define trigPin 11
#define echoPin 12
int pot = 0;
int potPin = A0;
int slider = 0;
int slidePin = A1;
int frequency = 0;
int soundPin = 8;
int led = 11;
int brightness = 0;
void setup() {
int photoPin = A0;
int sensorReading = 0;
int frequency = 0;
int soundPin = 8;
void setup() {
Serial.begin(9600);
// pinMode(soundPin, OUTPUT);
}
int pot = 0;
int potPin = A0;
int brightness1 = 0;
int brightness2 = 0;
int oneLED = 9;
int twoLED = 10;
int photoPin = A1;
int lightVal = 0;
void setup() {
@kaeleng
kaeleng / lab2.ino
Created September 18, 2018 23:43
Code for lab 2 part 2
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(5, PIN, NEO_GRB + NEO_KHZ800);
const int buttonPin1 = 2;