Midterm project. Maxim Blinov

Good day everyone!

So my project went as planned, except for some small changes. It is a tilt maze which actually work pretty well! Less detail, here is the video:

Here is my code which operates 2 servos and 2 pressure sensors.

#include <Servo.h>
 
Servo myServo;
Servo myServo1;


void setup() {
  myServo.attach(9);
  Serial.begin(9600);
  myServo1.attach(10);
  
}

void loop() {

  int pressure1 = analogRead(A0);
  int pressure2 = analogRead(A3);
  Serial.print(pressure1);
  Serial.print(" ");
  Serial.println(pressure2);
  int angle1 = map(pressure1, 0,970,90,30);
  int angle2 = map(pressure2, 0,970,110,30);
  myServo.write(angle1);
  myServo1.write(angle2);

}

 

Midterm project

What I plan to do for my midterm project is a tilt maze.  I plan to make a wooden maze which will be tilted by servos which will be controlled in a very uncommon way. For example to tilt the X axis clockwise breathe on this sensor. And so on 🙂 I came up with this idea during the discussions yesterday and I really liked it how it turned out. Rick gave me some ideas about the controls, and Steve gave me some feedback on the idea in general. Mostly they liked the idea.

Group project with Rick

Greetings friends!

For this weekly assignment, we have created a music buzzer with a bpm bird.

We have made the song “All star” using piano notes and tone.h to make
make it sound like the actual song. It took a long time to make it because I had to make a list of notes manually from the music score. Rick made a BPM bird using a servo to hit the beat once per 400ms, and in combination it sounded on sync. The problems that we’ve encountered was that servo.h and tone.h are not compatible with one another due to the inner-timer that these libraries use. We tried to look into the tone.h library to find the respective frequencies of the notes, but due to the delay issue, we had to separate the servo and the buzzer on separate Arduino boards to make it work properly.

Source Codes:

#include <Servo.h>

unsigned long previousMillis = 0;
const long interval = 7;
int angle = 0;

Servo myservo;

void setup() {
  myservo.attach(5);
}

void loop() {
  myservo.write(angle);
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    angle = (angle + 1) % 64;
  }
}
#include<Tone.h>
//                  0       1         2         3         4       5       6       7         8       9
int notes[11] = {NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_A4, NOTE_B4, NOTE_C5, NOTE_D5, NOTE_E5, 0};
int i = 0;
int duration[90] = {4, 2, 2, 4, 2, 2, 2, 4, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 6, 4,
                    2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 4, 2, 2, 4, 2, 2, 4, 4, 4,
                    2, 4, 1, 1, 2, 4, 1, 1, 2, 4, 4, 2, 4, 2, 4, 1, 1, 2, 4, 1, 1, 2, 4, 4, 2, 4,
                    4, 4, 2, 2, 2, 8, 2, 2, 2, 2, 8, 4, 2, 4, 4, 16
                   };
int note[90] = {4, 8, 6, 6, 5, 4, 4, 7, 6, 6, 5, 5, 4, 4, 8, 6, 6, 5, 5, 4, 4, 2, 10,
                4, 4, 8, 6, 6, 5, 5, 4, 4, 7, 6, 6, 5, 5, 4, 4, 8, 6, 6, 5, 4, 4, 5, 2, 10,
                6, 4, 4, 2, 4, 4, 4, 2, 4, 4, 4, 6, 10, 6, 4, 4, 2, 4, 4, 4, 2, 4, 4, 4, 6, 10,
                6, 8, 7, 6, 5, 5, 4, 4, 5, 4, 6, 5, 4, 5, 2, 10
               };
Tone player;

void setup() {
  player.begin(3);
}

void loop() {
  player.play(notes[note[i % 90]], duration[i % 90] * 100);
  delay(duration[i % 90] * 100 + 20);
  i++;
}

 

Project #3

This week’s project was to make something using an analog sensor to make an unexpected result. So i basically made a game where you have to turn the buzzer on. I will not include the code, because it can have the answers to how to turn the buzzer on. I use a potentiometer and a light sensor (a.k.a. light resistor). Nothing more to add, everything else you’ll see at the class presentation.

Switch v2.0

Greetings.

So during last class we have created a switch (an actual switch, not the button) . I have used this wonderful creation of ours to make a fire (not only fire but any type of) alarm. The program runs the usual to us part of code where the LED is turned on as the button is pressed and turned off as the button is pressed again. Then I have added the piezo buzzer to the circuit. The most challenging part was to differ the frequency of the sound to make it sound like an alarm. I’ve made a while loop that changes the frequency of the buzzer and it turns on like the LED switch. Code is attached bellow and the video will be uploaded later on, after the class presentation.

int buzz = 4;
int buttonPin = 2;
int ledPin = 3;
int ledState = LOW;
int prevButtonState = LOW;
bool inter = 0;

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);
  attachInterrupt(0, pin_ISR, CHANGE);

}
void loop() {
  int currentButtonState = digitalRead(buttonPin);
  if (ledState == HIGH)
  {
    int i = 100;
    while (inter && i < 5000)
    {
      tone(buzz, i, 5);
      i++;
    }
  }
  if (currentButtonState == HIGH && prevButtonState == LOW) {
    if (ledState == HIGH) {
      ledState = LOW;
    } else if (ledState == LOW) {
      ledState = HIGH;
    }
  }

  digitalWrite(ledPin, ledState);
  prevButtonState = currentButtonState;
}

void pin_ISR()
{
  Serial.print("h");
  delay(100);
  inter = !inter;
}


 

Reading response. Maxim Blinov.

Chris Crawford has changed my perspective of the definition “Interactive”. Going back to the class when we went out of the classroom to find something interactive on campus, Rick and I told that most of the things are “interactive”. It appears to be not. After understanding that interactive is “a cyclic process in which two actors alternately listen, think,and speak”, I have realized that most of the things on campus are just not interactive. They either think and speak, or just speak. For example, that class when we had to chose the interactive thing, I was about to chose the chalkboard in Baraha, but for some reasons I didn’t. I thought it was not interactive enough. But now, when I know the definition of interactive i can tell that it wasn’t interactive at all.

Playing cards switch!!1!!1!

Greeting fellas,

So today I was wondering what type of switch to do. We were told we need to make a switch not using our hands, but what if someone else triggers the switch (I’m not using my hands for it, duh).

So what I did was is connected the LED as we did in class and then the wire that goes from the power (5V) to the LED i just divided it into two. One part is connected to an edge of a card using tape, the edge had foil tape and the other one is connected to another card the same method. After that I place a card in between them to separate the contact and ask someone to pick a card (the middle one of course).

There we go, didn’t use my hands to trigger the switch 🙂