Below is my code: int buttonPin[8] = { 33, 34, 35, 36, 37, 38, 39, 13}; int totalButtonPins = 8; int ledPin[8] = { 23, 21, 20, 19, 18, 17, 16, 14}; int totalLeds = 8; bool lastButton1State[8] = { LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW}; bool button1State[8] = { LOW, LOW, LOW,Continue reading “Digital Electronics Lab Final”
Author Archives: seansmlee
Digital Electronics Lab 11
Below is my code in part_1_button: #include "Button.h" Button buttonOne(33, 1); Button buttonTwo(34, 3); Button buttonThree(35, 5); Button buttonFour(36, 6); void setup() { Serial.begin(9600); buttonOne.pressHandler(onPress); buttonOne.releaseHandler(onRelease); buttonTwo.pressHandler(onPress); buttonTwo.releaseHandler(onRelease); buttonThree.pressHandler(onPress); buttonThree.releaseHandler(onRelease); buttonFour.pressHandler(onPress); buttonFour.releaseHandler(onRelease); } void loop() { buttonOne.process(); buttonTwo.process(); buttonThree.process(); buttonFour.process(); } void onPress(int buttonNumber) { Serial.print(buttonNumber); Serial.println(" pressed"); } void onRelease(int buttonNumber) { Serial.print(buttonNumber); Serial.println("Continue reading “Digital Electronics Lab 11”
Digital Electronics Lecture Assignment 9 (Edited)
Below is my Processing code: import processing.serial.*; Serial teensySerial; int val = 0; int r = 0; int g = 0; int b = 0; int shapeX = 0; int shapeY = 0; int shapeSize = 0; int shapeSpeed = 0; void setup() { size(600, 600); printArray(Serial.list()); String usbPortName = Serial.list()[8]; teensySerial = new Serial(this, usbPortName, 9600); Continue reading “Digital Electronics Lecture Assignment 9 (Edited)”
Digital Electronics Lab 10
Below is my Processing Code: import processing.serial.*; Serial teensySerial; int inputVal = 0; int pot1 = 0; int pot2 = 0; int pot3 = 0; int pot4 = 0; int pot5 = 0; int squareSize = 0; int squareX =0; int squareSpeedX = 0; int squareY = 0; int squareSpeedY = 0; void setup() { frameRate(30);Continue reading “Digital Electronics Lab 10”
Digital Electrics Lab 9
Below is my code: int buttonPin[4] = { 33, 34, 35, 36 }; int totalButtonPins = 4; int ledPin[4] = { 22, 21, 20, 19 }; int totalLeds = 4; bool lastButton1State[4] = { LOW, LOW, LOW, LOW }; bool button1State[4] = { LOW, LOW, LOW, LOW }; boolean switchedOn[3][4] = { { LOW, LOW,Continue reading “Digital Electrics Lab 9”
Digital Electrics Lab 8
Below is my code: int buttonPin[4] = { 33, 34, 35, 36 }; int totalButtonPins = 4; int ledPin[4] = { 8, 9, 10, 11 }; int totalLeds = 4; bool lastButton1State[4] = { LOW, LOW, LOW, LOW }; bool button1State[4] = { LOW, LOW, LOW, LOW }; bool switchedOn[4] = { false, false, false,Continue reading “Digital Electrics Lab 8”
Digital Electrics Lab 7
Push On and Off Button:There are two variables, lastButton1State and button1State. In the checkButton mode, it first sets the two variables equal to each other. Then it reads what state the buttonpin is, whether it is high or low and sets that equals to button1State. Then in the if statement, it tells that if theContinue reading “Digital Electrics Lab 7”
Digital Electrics Lab 6
Below is my code: int ledPin1 = 8; int ledPin2 = 9; int ledPin3 = 10; int ledPin4 = 11; int ledPinArray[4] = { 8, 9, 10, 11 }; int totalLeds = 4; int potVal1 = 0; int potVal2 = 0; int potVal3 = 0; int potVal4 = 0; int potValArray[4] = { 0, 0,Continue reading “Digital Electrics Lab 6”
Digital Lecture Assignment 5
Below is my code: int ledPin1 = 8; int ledPin2 = 9; int ledPin3 = 10; int ledPin4 = 11; int ledPinArray[4] = { 8, 9, 10, 11 }; int totalLeds = 4; unsigned long lastStepTime = 0; int currentStep = 0; int totalSteps = 4; int tempo = 400; int backwardsSwitch = 39; voidContinue reading “Digital Lecture Assignment 5”
Digital Electronics Lab 5
Below is my code: int ledPinArray[4] = { 8, 9, 10, 11 }; int totalLeds = 4; int potValArray[4] = { 0, 0, 0, 0 }; int potAnalogRead[4] = { A15, A16, A17, A18 }; int totalPotVals = 4; int mappedPotValArray[4] = { 0, 0, 0, 0 }; int powerSwitch = 33; int octaveSwitch =Continue reading “Digital Electronics Lab 5”