Skip to content

Instantly share code, notes, and snippets.

#include "SD.h"
#define SD_ChipSelectPin 10
#include "TMRpcm.h"
#include "SPI.h"
#include <CapacitiveSensor.h>
TMRpcm tmrpcm;
//This is the code for our sound, we have two capacitive
// touch sensors, when touched they each play/loop a different sound
// from the SD card reader
#include <CapacitiveSensor.h> //library
#include <Servo.h> //library
CapacitiveSensor cs_2 = CapacitiveSensor(7,5); //pins for sensor
Servo myservo;
//This is the code for our continuous servo motor,
// we have one capacitive touch sensor, when
// touched the motor spins
@fernv11
fernv11 / DC-Motor
Last active November 13, 2019 03:00
const int switchPin = 2; // 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 motor2pin=5;
const int enablePin = 9;
int reading;
void setup() {
Serial.begin(9600);
pinMode(switchPin,INPUT);
#include <Stepper.h>
//include library
const int stepsPerRevolution = 513; //makes full revolution
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
void setup() {
// set the speed at 60 rpm:
/*
This P5 sketch is a template for getting started with Serial Communication.
The SerialEvent callback is where incoming data is received
By Arielle Hein, adapted from ITP Phys Comp Serial Labs
Edited March 12 2019
*/
int incomingByte;
int red=10; //redLED
int green=9; //greenLED
void setup() {
Serial.begin(9600);
}
int analogPin=A0; //photoresistors analog input
int speaker=8; //speaker
int freq;
int reading;
void setup() {
Serial.begin(9600);
pinMode(analogPin,INPUT); //input
pinMode(speaker,OUTPUT); //output
int poten=A0; //potentiometer analog input
int reading; //read the potentiometer
int slider=A1; //variable resistor (slider) analog input
int readingTwo; //read the slider
int ledOne=9; //2 yellow LEDs
int ledTwo=10; //1 red LED
void setup() {
int button1=8;
int button2=6;
int LEDs=7;
int state=0;
void setup() {
Serial.begin(9600);
int button1=8;
int LEDs=7;
int state=0;
void setup() {
Serial.begin(9600);
pinMode(button1,INPUT);
pinMode(LEDs, OUTPUT);