Skip to content

Instantly share code, notes, and snippets.

#include <SoftwareSerial.h>
#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include "WaveUtil.h"
#include "WaveHC.h"
SoftwareSerial mySerial(6, 7);
#include <SoftwareSerial.h>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN1 12 // On Trinket or Gemma, suggest changing this to 1
#define PIN2 13 // On Trinket or Gemma, suggest changing this to 1
#include <Stepper.h>
const int numSteps = 512;
// initialize the stepper library on pins 8 through 11:
Stepper stepper1(numSteps, 8, 9, 10, 11);
void setup() {
// set the speed at 20 rpm:
stepper1.setSpeed(20);
#include <Stepper.h>
const int numSteps = 512;
// initialize the stepper library on pins 8 through 11:
Stepper stepper1(numSteps, 8, 9, 10, 11);
void setup() {
// set the speed at 20 rpm:
stepper1.setSpeed(20);
#include <Stepper.h>
const int numSteps = 512;
// initialize the stepper library on pins 8 through 11:
Stepper stepper1(numSteps, 8, 9, 10, 11);
void setup() {
// set the speed at 30 rpm:
stepper1.setSpeed(30);
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 enablePin = 9; // H-bridge enable pin
void setup() {
// set the switch as an input:
Serial.begin(9600);
pinMode(2, INPUT);
int incomingByte;
void setup() {
Serial.begin(9600);
pinMode(8, OUTPUT);
}
void loop() {
int potVal1= analogRead(A0);
int potVal2 = analogRead(A2);
var serial; //variable to hold an instance of the serial port library
var portName = '/dev/tty.usbmodem14411'; //fill in with YOUR port
var pot1 = 0;
var pot2 = 0;
function setup() {
createCanvas(600, 400);
@alro2377
alro2377 / Lab 3 Part 3
Created October 4, 2019 23:01
Lab 3 Part 3
void setup() {
Serial.begin(9600);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(A0, INPUT);
pinMode(A2, INPUT);
}
void loop() {
@alro2377
alro2377 / Lab 3 Part 2
Created October 4, 2019 22:41
Lab 3 Part 2
void setup() {
Serial.begin(9600);
}
void loop() {
int photoVal = analogRead(A0);
Serial.println(photoVal);
// delay(500);
float freq = map(photoVal,0,1023,100,1000);