For my Final Project I created a visual representation of the notes played by my drum sequencer. I paired Processing with Arduino, and sent numbers to Processing whenever a note played on my drum sequencer. Depending on the note, a different colored circle flashes in Processing. Here is the Arduino code: int buttonPins[9] = {14,Continue reading “Digital Electronics Final Project”
Category Archives: Uncategorized
Digital Lecture 10
pressCallback and releaseCallback are variable functions. Each one holds a function as a variable. This allows for the flexibility demonstrated in our program today. When we change the onPress and onRelease functions, they are updated in the variable. #include “Button.h” Button buttonOne(36, 0); Button buttonTwo(35, 1); Button buttonThree(34, 2); Button buttonFour(33, 3); int ledPins[4] =Continue reading “Digital Lecture 10”
Digital Lab 11
The Code: int buttonPins[5] = {29, 30, 31, 32, 33}; int totalButtons = 5; int ledPins[4] = {7, 8, 9, 10}; int total = 4; int channelLEDs[3] = {18, 17, 16}; int totalChannels = 3; bool lastButtonState[4] = {LOW, LOW, LOW, LOW}; bool buttonState[4] = {LOW, LOW, LOW, LOW}; bool lastButtonState2 = LOW; bool buttonState2Continue reading “Digital Lab 11”
Digital Lab 10
Code: int buttonPins[4] = {36, 35, 34, 33}; int ledPins[4] = {29, 30, 31, 32}; int total = 4; bool lastButtonState[4] = {LOW, LOW, LOW, LOW}; bool buttonState[4] = {LOW, LOW, LOW, LOW}; bool switchedOn[4] = {false, false, false, false}; unsigned long lastStepTime = 0; int currentStep = 0; int tempo = 0; void setup()Continue reading “Digital Lab 10”
Digital Lab 09
This is the Arduino code: int potValArray[5] = {0, 0, 0, 0, 0}; int potPinArray[5] = {A18, A17, A16, A15, A14}; int totalPots = 5; void setup() { Serial.begin(9600); } void loop() { Serial.write(0); //Serial.println(0); for(int i = 0; i < totalPots; i++){ potValArray[i] = analogRead(potPinArray[i]); potValArray[i] = map(potValArray[i], 0, 1023, 1, 255); Serial.write(potValArray[i]); delay(50);Continue reading “Digital Lab 09”
Digital Lecture 08
This is the code for the Arduino: int ledPinArray[4] = {29, 30, 31, 32}; int ledTotal = 4; int potVal = 0; void setup() { Serial.begin(9600); for(int i = 0; i < ledTotal; i++){ pinMode(ledPinArray[i], OUTPUT); } } void loop() { for(int i = 0; i < ledTotal; i++){ potVal = analogRead(A14); Serial.write(i);Continue reading “Digital Lecture 08”
Digital Electronics Lab 08
How does the button work in this code? In every iteration of the loop, the code checks the current state of the button and the previous state of the button. In order to determine if the button has been pressed, the previous state of the button would need to be low and the current stateContinue reading “Digital Electronics Lab 08”
Digital Lab #6
The Code: unsigned long lastStepTime = 0; int currentStep = 0; int lastStep = 5; int tempo = 0; int ledPinArray[4] = {29, 30, 31, 32}; int ledPitches[4] = {0, 0, 0, 0}; int totalLeds = 4; int switchPin1 = 34; int switchPin2 = 33; int switchPin3 = 27; void setup() { Serial.begin(9600); for(int iContinue reading “Digital Lab #6”
Digital Electronics Lecture 5
The code: unsigned long lastStepTime = 0; int currentStep = 0; int tempo = 0; int switchPinArray[2] = {34, 33}; int ledPinArray[4] = {29, 30, 31, 32}; int totalLEDs = 4; void setup() { Serial.begin(9600); for(int i = 0; i < 2; i++){ pinMode(switchPinArray[i], INPUT); } for(int i = 0; i < totalLEDs; i++){ pinMode(ledPinArray[i],Continue reading “Digital Electronics Lecture 5”
Digital Electronics Lab 5
int switchPinArray[3] = {13, 39, 38}; int totalSwitches = 3; int inputArray[5] = {A18, A17, A16, A15, A14}; int potValArray[5] = {0, 0, 0, 0, 0}; int totalPotVals = 5; int mappedPotVal = 0; int potVal = 0; int mappedPotVal2 = 0; int ledPinArray[4] = {25, 28, 30, 32}; int totalLeds = 4; int ledPitchArray[4]Continue reading “Digital Electronics Lab 5”