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.
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.
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.
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;
}
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.
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 🙂