Digital Lab 10

Aidan Singh

This lab introduced the Processing app and language, and how to make it interface with Arduino using Serial commands.

The instructional video created by Professor Litt showed a circle first translating and growing based on input from two potentiometers, and later automatically moving across the screen, at a rate determined by one of the potentiometers.

For the assignment which required use of 5 potentiometers, I made them control the size, position and color of an ellipse (height, width, center x and y coordinates, and amount of blue.)

int ledPin = 32;
int potPin [5] = {A14,A15,A16,A17,A18};
int potVal[5] = {0,0,0,0,0};
int mappedPotVal[5] = {0,0,0,0,0};

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
}

void loop() {

  Serial.write(0);

  for(int i=0; i<5;i++){
    potVal[i] =analogRead(potPin[i]);
    mappedPotVal[i] = map(potVal[i], 0, 1023, 1, 255);
    Serial.write(mappedPotVal[i]);
  }
  
  delay(50);

}

Leave a comment

Design a site like this with WordPress.com
Get started