endotaxy-blog
endotaxy-blog
14 posts
alex sadosky's digi-elec bloj
Don't wanna be here? Send us removal request.
endotaxy-blog · 8 years ago
Video
youtube
deer game
Alex Sadosky
Professor Litt
14 December 2017
link to Max patch and obj models
https://drive.google.com/drive/folders/1J74O6uaZbdS7BQbWE1FmIO-v8E2dVtw0?usp=sharing
Simple Explanation
For my Digital Electronics final project I made a game in Max/MSP/Jitter. In the game, you're a deer being chased by another deer and by visiting the different trees you can choose whether your little stalker loves you or hates you. The stalking deer's emotions are shown through music, video, and words.
 In-depth Explanation
The movement of the character is controlled with a joystick. The joystick is made up of two potentiometers. Moving the joystick turns the pots which changes the voltage running through them. The voltages are sent to the Teensy and then to Arduino and then to Max as MIDI data. In Arduino, the analog voltage data from each pot is mapped to just three values so one pot makes the character go left, right, or stay still, while the other makes the character go up, down, or stay still. This way we can get 2D movement. In Max these three data points are translated to forward, backward, or still (up, down, or still). The lead deer's position data is used to trigger different video and music. If the lead deer is to the left of the love tree, sunrise video and major-music are triggered. If the lead deer is to the right of the hate tree, fire video and minor-music are triggered In Max I'm using a jit.gl.videoplane object to get video to play behind the animation. This takes a lot of processing power and makes the game laggy and in the future an alternative should be found. The trees and the deer are 3D OBJ models.  These are convenient for my game because they include easy commands for position and 3D rotation. Based on whether the lead deer has most recently visited the tree of love or hate, the chasing deer's words are randomly chosen from a bank of pining or hateful phrases. The change in phrase happens when the lead deer changes horizontal directions.
Arduino Code
//My game in Max, controlled with joystick int analogPin = A13;  //for vertical pot int analogPin2 = A12; //for horizontal pot int pot_hor = 0; int pot_vert = 0;
void setup() { pinMode(analogPin, INPUT); pinMode(analogPin2, INPUT); //Serial.begin(9600); }
void loop() { do_stuff(); }
void do_stuff(){  pot_hor = analogRead(analogPin);  pot_vert = analogRead(analogPin2); // Serial.println("pot_hor111"); //to be used when things stop working // Serial.println(pot_hor);  //Serial.println("pot_vert22");  //Serial.println(pot_vert);  pot_hor = map(pot_hor, 1, 1023, 1, 3);// map pot val to either going left, motionless, or right   pot_vert = map(pot_vert, 1, 1023, 61, 63);
 usbMIDI.sendNoteOn(pot_hor, 0, 0); //send pot vals to max   usbMIDI.sendNoteOn(pot_vert, 0, 1);    delay(40);  //make sure we don't send too much data at once }
0 notes
endotaxy-blog · 8 years ago
Video
tumblr
This video shows me controlling the movement of a deer with a pot. I’m controlling the pixely deer and the smooth deer is chasing.
I didn’t have another blue pot to practice the vertical movement but the joystick has two pots.
Tomorrow I’ll switch the pot for my new joystick that needs to be soldered.
After wiring the joystick and adding better graphics and sound, I was thinking of using a fidget spinner, LED, and light sensor to control some aspect of the game. The fidget spinner would come between the LED and the light sensor, and its speed would be used in the game.
0 notes
endotaxy-blog · 8 years ago
Video
youtube
Second week working final project day-of-lab post
This was practice interfacing arduino and Max. A button push makes the pink cube move a certain distance. The deer chases it and when it catches it the game is over.
Today I bought a joystick. The joystick will replace the button. 
To do:
Rig the joystick and button.
A lot more graphics and text to add to make it a nice pretty video game.
I was considering adding a weird feature to the game: an LED and a light sensor facing each other with a fidget spinner in between. The speed of the fidget spinner will effect something in the game.
0 notes
endotaxy-blog · 8 years ago
Video
youtube
This week I have the beginnings of a game in Jitter. Still I need to buy one or two joysticks and figure out what other sensors and characteristics the game will have. And still I need to write the code that connects arduino, the sensors, and Jitter.
0 notes
endotaxy-blog · 8 years ago
Text
lecture week 8 homework
https://github.com/asadosky
0 notes
endotaxy-blog · 8 years ago
Video
tumblr
Lab 8
Tumblr media Tumblr media
int analogPin = A14; int led_pin = 2; int foto_r = 0; int currentStep = 0; unsigned long lastStepTime = 0; int tempo = 100; boolean tog_last_state = LOW; boolean tog_button_state = LOW; boolean tog_step_state = LOW; boolean tog_last_state2 = LOW; boolean tog_button_state2 = LOW; boolean tog_step_state2 = LOW; int count = 0; int dark = 700; int light = 800;
boolean last_state = false;
void setup() { Serial.begin(9600);  pinMode(23, INPUT);  pinMode(22, INPUT);  pinMode(analogPin, INPUT);   pinMode(led_pin, OUTPUT); }
void loop() {  play_note(); print_okay();  calibrate_light();    calibrate_dark(); } void print_okay(){   if (millis() > lastStepTime + tempo) {      lastStepTime = millis();//increment to the next step foto_r = analogRead(analogPin); Serial.print("sensorVal "); Serial.println(foto_r);   } } void play_note(){   if (foto_r > (light - 200) && last_state == false)  { //if light    usbMIDI.sendNoteOff(52, 0, 0);    digitalWrite(led_pin, LOW);   // Serial.println("OFF_DARK_OFF");    last_state = true;
  }   else if (foto_r < (dark + 200) && last_state == true){ //if dark. //left button   usbMIDI.sendNoteOn(52, 127, 0);   digitalWrite(led_pin, HIGH);   Serial.println("ON_LIGHT_ON");   last_state = false; } }
void calibrate_dark(){    tog_last_state = tog_button_state;    tog_button_state = digitalRead(23);    if (tog_button_state == HIGH && tog_last_state == LOW)      { dark = foto_r; Serial.print("dark "); Serial.println(dark);} }    void calibrate_light(){    tog_last_state2 = tog_button_state2;    tog_button_state2 = digitalRead(22);    if (tog_button_state2 == HIGH && tog_last_state2 == LOW)      { light = foto_r;        Serial.print("light "); Serial.println(light);}    }
//860 high //450 low
0 notes
endotaxy-blog · 8 years ago
Video
youtube
//third button from the left changes the channel
//sometimes when you press it it jumps more than one channel
int buttonPin[5] = {23, 22, 21, 20, 19}; int ledPin[4] = {2, 3, 4, 5}; boolean lastButtonState[3][5] = {{LOW, LOW, LOW, LOW}, {LOW, LOW, LOW, LOW}, {LOW, LOW, LOW, LOW}}; boolean buttonState[3][5] = {{LOW, LOW, LOW, LOW}, {LOW, LOW, LOW, LOW}, {LOW, LOW, LOW, LOW}}; boolean stepState[3][4] = {{false, false, false, false},  {false, false, false, false},  {false, false, false, false}}; boolean tog_last_state = LOW; boolean tog_button_state = LOW; boolean tog_step_state = LOW;
int currentStep = 0; unsigned long lastStepTime = 0; int tempo = 200; int noteArray[3][4] = {{40, 42, 44, 45},  {60, 62, 64, 65},  {70, 72, 74, 75}}; int bC = 0; //buttonCount
void setup() {  for (int k = 0; k < 5; k++) {    pinMode(buttonPin[k], INPUT); //initialize buttons pins    pinMode(ledPin[k], OUTPUT);  }  Serial.begin(9600); }
void loop() {  checkButtons();  setLeds();  sequence();
}
void checkButtons() { //see if buttons&LEDs are switched on or off  tog_last_state = tog_button_state;  tog_button_state = digitalRead(19);  if (tog_button_state == HIGH && tog_last_state == LOW)  {    if (tog_step_state == false) {tog_step_state = true; }    bC++;    if (bC > 2) {bC = 0;}    Serial.println("button count"); Serial.println(bC);  }  else if (tog_step_state == true) {    tog_step_state = false;}   for(int n = 0; n < 3; n++) {  for (int i = 0; i < 4; i++) {    lastButtonState[bC][i] = buttonState[bC][i];    buttonState[bC][i] = digitalRead(buttonPin[i]);
   if (buttonState[bC][i] == HIGH && lastButtonState[bC][i] == LOW)  {      if (stepState[bC][i] == false) {        stepState[bC][i] = true;      }      else if (stepState[bC][i] == true) {        stepState[bC][i] = false;
     }    }  }   }
}
void setLeds() {  for (int j = 0; j < 4; j++) {
   if (stepState[bC][j] == true ) {      analogWrite(ledPin[j], 20);
   } else if (stepState[bC][j] == false ) {      analogWrite(ledPin[j], 0);    }  } }
void sequence() {  tempo = 400;  if (millis() > lastStepTime + tempo) {   //if its time to go to the next step...    //turn off the current led    currentStep = currentStep + 1;    lastStepTime = millis();//increment to the next step    if (currentStep > 3) {currentStep = 0;}  }  for (int a = 0; a < 3; a++) {    if (stepState[a][currentStep] == true) {      usbMIDI.sendNoteOn(noteArray[a][currentStep], 127, 0);}
   else {usbMIDI.sendNoteOff(0, 0, 0); }}
 analogWrite(ledPin[currentStep], 150);// this line could go in any function }
0 notes
endotaxy-blog · 8 years ago
Video
youtube
lab 6
//meeting a switched on light will trigger one of 9 samples, randomly chosen.
//meeting a switched on light will set the bass-note to that light’s assigned note.
int buttonPin[4] = {23, 22, 21, 20}; int ledPin[4] = {2, 3, 4, 5}; boolean lastButtonState[4] = {LOW, LOW, LOW, LOW,}; boolean buttonState[4] = {LOW, LOW, LOW, LOW,}; boolean stepState[4] = {false, false, false, false,}; int currentStep = 0; unsigned long lastStepTime = 0; int tempo = 200; int noteArray[4] = {60, 61, 62, 63};
void setup() {  for (int buby = 0; buby < 4; buby++) {    pinMode(buttonPin[buby], INPUT); //initialize buttons pins    pinMode(ledPin[buby], OUTPUT);  }  Serial.begin(9600); }
void loop() {  checkButtons();
 setLeds();  sequence();
}
void checkButtons() { //see if buttons&LEDs are switched on or off  for (int i = 0; i < 4; i++) {    lastButtonState[i] = buttonState[i];    buttonState[i] = digitalRead(buttonPin[i]);    if (buttonState[i] == HIGH && lastButtonState[i] == LOW)  {      if (stepState[i] == false) {        stepState[i] = true;        Serial.println("led on");        Serial.println(i);      }
     else if (stepState[i] == true) {        stepState[i] = false;        Serial.println("led off");        Serial.println(i);      }    }  } }
void setLeds() {  for (int j = 0; j < 4; j++) {    if (stepState[j] == true ) {      analogWrite(ledPin[j], 20); //always stepping with 2. when clicked on: 120
   } else if (stepState[j] == false ) {      analogWrite(ledPin[j], 0);    }  } }
void sequence() {  tempo = 400;  if (millis() > lastStepTime + tempo) {   //if its time to go to the next step...    //turn off the current led    currentStep = currentStep + 1;    lastStepTime = millis();//increment to the next step    if (currentStep > 3) {      currentStep = 0;    }  }  if (stepState[currentStep] == true) {    usbMIDI.sendNoteOn(noteArray[currentStep], 127, 0);  }  else {    usbMIDI.sendNoteOn(0, 0, 0); //zero velocity here most important  }  analogWrite(ledPin[currentStep], 150);// this line could go in any function
}
0 notes
endotaxy-blog · 8 years ago
Video
youtube
//code with leaves
#include <SPI.h> #include <Audio.h> #include <Wire.h> #include <SPI.h> #include <SD.h> #include <SerialFlash.h>
AudioSynthWaveform waveform1; AudioOutputAnalog dac1; AudioConnection patchCord1(waveform1, 0, dac1, 0);
int chipSelectPin = 10; int maxResistance = 127; int tempo = 10; float inc = 0.; //needs to be float so it can change volume between 0. and 1. int incAdd = 1; int buttonPin1 = 23; int buttonPin2 = 22; int buttonPin3 = 21; int buttonPin4 = 20; unsigned long timee = 0;
boolean buttonState = LOW; boolean buttonState2 = LOW; boolean buttonState3 = LOW; boolean buttonState4 = LOW;
void setup() {     pinMode(buttonPin1, INPUT); //button pin     pinMode(buttonPin2, INPUT);     pinMode(buttonPin3, INPUT);     pinMode(buttonPin4, INPUT);      pinMode(A14, INPUT); //last analog input  SPI.begin();  pinMode(chipSelectPin, OUTPUT); Serial.begin(9600); AudioMemory(12); //always include this even if you don't know what it is! waveform1.begin(WAVEFORM_SINE); waveform1.amplitude(0.0); //amplitude (volume) can be 0 to 1 and this is a good volume for headphones waveform1.frequency(262); }
void loop() { simplify(); }
void simplify(){
   buttonState = digitalRead(buttonPin1);    if(buttonState == HIGH )    {timing(); Serial.println("button on");waveform1.frequency(262);}
     buttonState2 = digitalRead(buttonPin2);    if(buttonState2 == HIGH )    {timing(); Serial.println("button2 on"); waveform1.frequency(330);}
       buttonState3 = digitalRead(buttonPin3);    if(buttonState3 == HIGH )    {timing(); Serial.println("button3 on"); waveform1.frequency(440);}
       buttonState4 = digitalRead(buttonPin4);    if(buttonState4 == HIGH )    {timing(); Serial.println("button4 on"); waveform1.frequency(494);}    }
void timing(){  tempo = analogRead(A14);
 tempo = map(tempo, 0, 1023, 3, 50);  Serial.println(tempo); if(millis() > timee + tempo) {        inc += incAdd ;    digitalWrite(chipSelectPin, LOW);  SPI.transfer(0);  //always set to 0  waveform1.amplitude( (inc / 40.0) + 0.5);  SPI.transfer(inc);  //set to 7 bit resistance (from 0 to 127)  digitalWrite(chipSelectPin, HIGH);  if(inc > 40) { incAdd = -incAdd;}  if(inc < 1) { incAdd = -incAdd;}     //set lastStepTime to the current time    timee = millis();   } }
0 notes
endotaxy-blog · 8 years ago
Video
youtube
Quantized notes come close to the notes of the equal tempered scale. Unquantized notes don’t. Check on the chart! 
Note                               Frequency                                     Wavelength
Tumblr media
#include <Audio.h> #include <Wire.h> #include <SPI.h> #include <SD.h> #include <SerialFlash.h>
// GUItool: begin automatically generated code AudioSynthWaveform       waveform1;      //xy=219,635 AudioOutputAnalog        dac1;           //xy=364,643 AudioConnection          patchCord1(waveform1, dac1); // GUItool: end automatically generated code
int pitchArray[4] = {196, 220, 261, 294}; int buttonPin = 7; int ledPinInc = 9; int potVal = 0; int potVal2 = 0; int potVal3 = 0; int potVal4 = 0; int potVal5 = 0; int answer = 0; int switchPin = 33;
void setup() {  // put your setup code here, to run once:   Serial.begin(9600); AudioMemory(12); waveform1.begin(WAVEFORM_SINE); waveform1.amplitude(0.6); //amplitude (volume) can be 0 to 1 and this is a good volume for headphones waveform1.frequency(262);  pinMode(9, OUTPUT);  pinMode(10, OUTPUT);  pinMode(11, OUTPUT);  pinMode(12, OUTPUT);   pinMode(buttonPin, INPUT);   pinMode(switchPin, INPUT); }
void loop() {    potVal = analogRead(1);    potVal2 = map(analogRead(2), 0, 1023,261,523);    potVal3 = map(analogRead(3), 0, 1023,261,523);    potVal4 = map(analogRead(4), 0, 1023,261,523);    potVal5 = map(analogRead(5), 0, 1023,261,523); if(digitalRead(switchPin) == HIGH) { pitchArray[0] = potVal2;   pitchArray[1] = potVal3; pitchArray[2] = potVal4; pitchArray[3] = potVal5; Serial.println("1st pitch not quantized"); Serial.println(pitchArray[0]); Serial.println("2nd pitch not quantized"); Serial.println(pitchArray[1]); Serial.println("3rd pitch not quantized"); Serial.println(pitchArray[2]); Serial.println("4th pitch not quantized"); Serial.println(pitchArray[3]); } else if(digitalRead(switchPin) == LOW){ pitchArray[0] = 262. * pow(2., (map(potVal2, 261., 523., 0., 12.) / 12.));  //tuned values pitchArray[1] = 262. * pow(2., (map(potVal3, 261., 523., 0., 12.) / 12.)); pitchArray[2] = 262. * pow(2., (map(potVal4, 261., 523., 0., 12.) / 12.)); pitchArray[3] = 262. * pow(2., (map(potVal5, 261., 523., 0., 12.) / 12.)); Serial.println("1st pitch quantized"); Serial.println(pitchArray[0]); Serial.println("2nd pitch quantized"); Serial.println(pitchArray[1]); Serial.println("3rd pitch quantized"); Serial.println(pitchArray[2]); Serial.println("4th pitch quantized"); Serial.println(pitchArray[3]); } answer = pitchArray[ledPinInc-9]; //index my array for pitches //f2 = f1 * 2^(X/12.0) delay(30); // Serial.println(digitalRead(switchPin)); //print the switch  if(1 == 1) {            digitalWrite(ledPinInc, HIGH); //lights lights in sequence    waveform1.frequency(answer);  //changes a frequency    delay(potVal);    digitalWrite(ledPinInc, LOW);    delay(potVal / 4);  //shorter time light is off    ledPinInc += 1;    if(ledPinInc == 13) //loop led pin count    {ledPinInc = 9;}  }}
0 notes
endotaxy-blog · 8 years ago
Video
youtube
int buttonPin1 = 2; int buttonPin2 = 3; int buttonPin3 = 6; int buttonPin4 = 7; int buttonPin5 = 8; int toggle = 0; int ledPin9 = 9; int potVal; boolean lastButtonState1 = LOW; boolean buttonState1 = LOW; boolean lastButtonState2 = LOW; boolean buttonState2 = LOW; boolean lastButtonState3 = LOW; boolean buttonState3 = LOW; boolean lastButtonState4 = LOW; boolean buttonState4 = LOW; boolean lastButtonState5 = LOW; boolean buttonState5 = LOW;
void setup() {  pinMode(buttonPin1, INPUT);  pinMode(buttonPin2, INPUT);  pinMode(buttonPin3, INPUT);  pinMode(buttonPin4, INPUT);    pinMode(buttonPin5, INPUT);  pinMode(ledPin9, OUTPUT);  pinMode(10, OUTPUT);  pinMode(11, OUTPUT);  pinMode(12, OUTPUT); }
void loop() {  //these three lines to toggle between keyboard and arpeggio lastButtonState5 = buttonState5; buttonState5 = digitalRead(buttonPin5); if(digitalRead(buttonPin5) == HIGH) {toggle += 1;} if(toggle == 2) {toggle = 0;}
if(toggle == 0) {arpeggioMode(60, 62, 64, 66);} else if(toggle == 1) {keyboardMode();}
}
void arpeggioMode(int note, int note2, int note3,int note4) {   potVal = analogRead(2) ;   potVal = map(potVal, 0, 1023, 50, 500);  lastButtonState1 = buttonState1;  buttonState1 = digitalRead(buttonPin1);  //four repetitions of an arpeggio, with different notes each  if (buttonState1 == HIGH && lastButtonState1 == LOW) {    digitalWrite(9, HIGH);  usbMIDI.sendNoteOn(note, 127, 1);    delay(potVal); digitalWrite(9, LOW); usbMIDI.sendNoteOff(60, 0, 1);    digitalWrite(9, HIGH);  usbMIDI.sendNoteOn(note + 2, 127, 1);  delay(potVal); digitalWrite(9, LOW); usbMIDI.sendNoteOff(71, 0, 1);    digitalWrite(9, HIGH);  usbMIDI.sendNoteOn(note + 4, 127, 1);  delay(potVal); digitalWrite(9, LOW); usbMIDI.sendNoteOff(71, 0, 1);    } else if (buttonState1 == LOW && lastButtonState1 == HIGH) {    digitalWrite(9, LOW); usbMIDI.sendNoteOff(60, 0, 1);  }
 lastButtonState2 = buttonState2;  buttonState2 = digitalRead(buttonPin2);  if (buttonState2 == HIGH && lastButtonState2 == LOW) { digitalWrite(10, HIGH);  usbMIDI.sendNoteOn(note2, 127, 1);    delay(potVal); digitalWrite(9, LOW); usbMIDI.sendNoteOff(note2, 0, 1);    digitalWrite(10, HIGH);  usbMIDI.sendNoteOn(note2 + 2, 127, 1);  delay(potVal); digitalWrite(9, LOW); usbMIDI.sendNoteOff(note2+2, 0, 1);    digitalWrite(10, HIGH);  usbMIDI.sendNoteOn(note2 + 4, 127, 1);  delay(potVal); digitalWrite(9, LOW); usbMIDI.sendNoteOff(note2+8, 0, 1);}   else if (buttonState2 == LOW && lastButtonState2 == HIGH) {    digitalWrite(10, LOW); usbMIDI.sendNoteOff(60, 100, 1);  }  lastButtonState3 = buttonState3;  buttonState3 = digitalRead(buttonPin3);  if (buttonState3 == HIGH && lastButtonState3 == LOW)  { digitalWrite(11, HIGH);  usbMIDI.sendNoteOn(note3, 127, 1);    delay(potVal); digitalWrite(9, LOW); usbMIDI.sendNoteOff(0, 0, 1);      digitalWrite(11, HIGH);  usbMIDI.sendNoteOn(note3 + 2, 127, 1);  delay(potVal); digitalWrite(9, LOW); usbMIDI.sendNoteOff(note3 + 12, 0, 1);    digitalWrite(11, HIGH);  usbMIDI.sendNoteOn(note3 + 4, 127, 1);  delay(potVal); digitalWrite(9, LOW); usbMIDI.sendNoteOff(note3 + 24, 0, 1);}    else if (buttonState3 == LOW && lastButtonState3 == HIGH) {    digitalWrite(11, LOW); usbMIDI.sendNoteOff(60, 100, 1);  }  lastButtonState4 = buttonState4;  buttonState4 = digitalRead(buttonPin4);  if (buttonState4 == HIGH && lastButtonState4 == LOW) { digitalWrite(12, HIGH);  usbMIDI.sendNoteOn(note4, 127, 1);    delay(potVal); digitalWrite(9, LOW); usbMIDI.sendNoteOff(0, 0, 1);      digitalWrite(12, HIGH);  usbMIDI.sendNoteOn(note4 + 2, 127, 1);  delay(potVal); digitalWrite(9, LOW); usbMIDI.sendNoteOff(note4 + 8, 0, 1);    digitalWrite(12, HIGH);  usbMIDI.sendNoteOn(note4 + 4, 127, 1);  delay(potVal); digitalWrite(9, LOW); usbMIDI.sendNoteOff(note3 + 11, 0, 1);}     else if (buttonState4 == LOW && lastButtonState4 == HIGH) {    digitalWrite(12, LOW); usbMIDI.sendNoteOff(60, 100, 1);} }
void keyboardMode() { //four buttons of keyboard  lastButtonState1 = buttonState1;  buttonState1 = digitalRead(buttonPin1);  if (buttonState1 == HIGH && lastButtonState1 == LOW) {    digitalWrite(9, HIGH);  usbMIDI.sendNoteOn(60, 127, 1);
 } else if (buttonState1 == LOW && lastButtonState1 == HIGH) {    digitalWrite(9, LOW); usbMIDI.sendNoteOff(60, 0, 1);  }  lastButtonState2 = buttonState2;  buttonState2 = digitalRead(buttonPin2);  if (buttonState2 == HIGH && lastButtonState2 == LOW) {    digitalWrite(10, HIGH);  usbMIDI.sendNoteOn(62, 100, 1);  } else if (buttonState2 == LOW && lastButtonState2 == HIGH) {    digitalWrite(10, LOW); usbMIDI.sendNoteOff(60, 100, 1);  }
 lastButtonState3 = buttonState3;  buttonState3 = digitalRead(buttonPin3);  if (buttonState3 == HIGH && lastButtonState3 == LOW) {    digitalWrite(11, HIGH);  usbMIDI.sendNoteOn(64, 100, 1);  } else if (buttonState3 == LOW && lastButtonState3 == HIGH) {    digitalWrite(11, LOW); usbMIDI.sendNoteOff(60, 100, 1);  }  lastButtonState4 = buttonState4;  buttonState4 = digitalRead(buttonPin4);  if (buttonState4 == HIGH && lastButtonState4 == LOW) {    digitalWrite(12, HIGH);  usbMIDI.sendNoteOn(66, 100, 1);  } else if (buttonState4 == LOW && lastButtonState4 == HIGH) {    digitalWrite(12, LOW); usbMIDI.sendNoteOff(60, 100, 1);}
}
0 notes
endotaxy-blog · 8 years ago
Video
tumblr
tinkercad version
int ledPin = 12; int buttonPin = 7; int ledPinInc = 9; int pushCount = 0; int potVal = 0;
//this is a comment void setup() {
 Serial.begin(9600);  pinMode(9, OUTPUT);  pinMode(10, OUTPUT);  pinMode(11, OUTPUT);  pinMode(12, OUTPUT);  pinMode(buttonPin, INPUT); }
void loop() { flashingLights();}
 flashingLights(){  if(digitalRead(buttonPin) == HIGH) {pushCount += 1; //this counts how many times button has been pressed. forward on 1, backward on 2, stop on 3.  Serial.println(" push button count");  Serial.print(pushCount); //when you push button, print count  }  if(pushCount == 5) {pushCount = 0;}  // loop button count
 potVal = analogRead(2);  potVal = (potVal / 10) + 10; // raise floor and lower ceiling for potentiometer value
 if(pushCount == 1) {      //if button count 1, flash lights forward    digitalWrite(ledPinInc, HIGH);    delay(potVal);    digitalWrite(ledPinInc, LOW);    delay(potVal / 4);  //shorter time light is off    ledPinInc += 1;    if(ledPinInc == 13) //loop led pin count    {ledPinInc = 9;}  }  else if(pushCount == 2) {     //if button count 2, flash lights forward    digitalWrite(ledPinInc, HIGH);    delay(potVal);    digitalWrite(ledPinInc, LOW);    delay(potVal);      ledPinInc -= 1;    if(ledPinInc == 8)    {ledPinInc = 12;}    else if(pushCount >= 3) {digitalWrite(ledPinInc, LOW);}  }
}
0 notes
endotaxy-blog · 8 years ago
Text
++lab one arDuinO examples**
How to Make a LED Cube at Home Tapendra Mandal made a cube of LEDs and has them lighting up in different patterns and designs. I’m not sure if he made them reactive to audio.
Hack an optical mouse into a camera with Arduino and Processing Conor Peterson broke open an optical mouse and connected it to arduino, letting him see the output of the mouse’s camera in Processing. It gave him a pixely image, and the mouse could only see a few millimeters away, but this is still a fun way to get image input, which could be further processed.
DIY Printing tiny images using Arduino Uno This is a tiny printer using arduino. It uses a black pen to draw on paper and print.
Camera This is a 2.5 frame per second camera made with arduino, with a video moniter on the teensy.
Glove This person made a sensor glove so that when he flexes his hand, there’s a lame little moving line on his computer.
Arduino Vocal Effects Box An box that can pitch shift and distort inputted audio.
Camera Control It seems in this project, this person uses a motion sensor and his arduino to make his camera take a picture. He captures water drops right before they hit a cup of water. Time-lapse videos It seems this guy is using arduino to automatically adjust camera settings during a time lapse video.
High speed photography This guy uses arduino to make his camera flash and shutter when there’s a loud sound, to capture photos at just the right second. He captures himself popping a balloon and smashing a glass.
Arduino Violin These guys used the sensor from a mouse and some buttons and some wood to make a simple arduino violin. The different buttons make different notes.
Top 10 Arduino Projects The one interesting project in this video was a little drone using arduino.
Chess Robot These people made a robot that can be one player in a chess match. I’m not sure how skillful the robot is, but it was able to move the pieces around.
Arduino Delta Robot Drawing Squares This person made his robot draw some nice squares with arduino. 
0 notes
endotaxy-blog · 8 years ago
Text
first tinkercad design
Simulator Link
updates to design:
blue LED
connected to pin 8 instead of 13
blinking loops forever
blinking is faster
push-button does nothing
Tumblr media
0 notes