Here are the videos and some screen recordings for the Arduino homework
- Multiple LED’s
- Fading LED
- RGB LED
- Arduino Input/Output
– Digital Input with LED & Button
– Serial Monitor
– Analog Input with controller
Here are the videos and some screen recordings for the Arduino homework
Hello,
I had a lot of fun with the RGB LED this week. Instead of using a pingpong ball to diffuse it I used a flexible plastic material and was able to film the subtle differences in color through my phone’s camera by placing the plastic directly on the lens of the camera. I played some Amadou & Mariam in the background for rhythm:
In the second exercise for this week it was hard to get super creative, but I was able to change the rate of fade. Here is a faster fade than the original with the delay at 5:
Thank you for visiting!
#chrisrand
Multi-color LED calibrated to the BPM of music, manual button fade of red LED, and manual button blinking LED (detent OFF).
Look! I just capture this iron butterfly! It keeps flapping in my hand and wants to fly away!
Hi, everybody! So, I did my best to modify this code a little bit, but never really understood why I couldn’t control the function better. I’m pocketing this question for class. But, here’s what the sample code looks like:
[code]
#include <Servo.h>
Servo myservo;
int pos = 0;
void setup()
{
myservo.attach(9);
}
void loop()
{
for(pos = 0; pos <= 180; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 180; pos>=0; pos-=1)
{
myservo.write(pos);
delay(15);
}
}
[/code]
Here’s the closest thing to the way I had it in the end, when it still wasn’t functioning… I don’t have a video of that, because it really wasn’t any different with the exception of a little skip in the middle of the sweep.
[code]
#include <Servo.h>
Servo myservo;
int pos = 0;
void setup()
{
myservo.attach(9);
void loop()
{
for(pos = 0; pos <= 10; pos += 1)
{
myservo.write(pos);
delay(50);
}
for(pos = 10; pos <= 20; pos -= 1)
{
myservo.write(pos);
delay(50);
}
for(pos = 10; pos <= 20; pos += 1)
{
myservo.write(pos);
delay(50);
}
for(pos = 20; pos <= 30; pos += 1)
{
myservo.write(pos);
delay(50);
}
for(pos = 30; pos <= 40; pos += 1)
{
myservo.write(pos);
delay(50);
}
for(pos = 40; pos <= 50; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 50; pos <= 60; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 60; pos <= 70; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 70; pos >= 80; pos -= 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 80; pos <= 90; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 90; pos <= 100; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 100; pos <= 110; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 110; pos <= 120; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 120; pos <= 130; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 130; pos <= 140; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 140; pos <= 150; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 150; pos <= 160; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 160; pos <= 170; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 170; pos <= 180; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 180; pos <= 0; pos -= 1)
{
myservo.write(pos);
delay(15);
}
}
[/code]
And here’s the video of the successful function, although I’m not happy that that’s all it does. I wanted it to function like an old yard sprinkler.
Thanks for looking!
Will
Please see my video attached.
Thank you for watching.
Oscar
Power Pants are the pants that make you proud of getting dressed in the morning! They’re not your average pants. They provide you with a nice sense of accomplishment every time you put them on!
Coming soon to a store near you!
What’s in a Power Pant?!
The tech:
Power Pants are built on Arduino, using a simple piezo and pulse width modulation to create audio from chosen frequencies. What you see above is one of two functions coded into the Arduino. The second function is the longer musical bit you hear in the video at the top. It uses the contact in the same way to trigger the sound.
Here’s the code:
[code]
int ledPin = 13;
int inputPin1 = 2;
int inputPin2 = 5;
int val1 = 0;
int val2 = 0;
int counter1 = 0;
int counter2 = 0;
int speakerPin = 9;
char notesA[] = "azbC"; // a space represents a rest
int lengthA = sizeof(notesA);
int beatsA[] = {2,3,3,12};
int tempoA = 80;
char notesB[] = "Cbza"; // a space represents a rest
int beatsB[] = { 2,3,3,4};
int tempoB = 80;
char notesC[] = "gabygabyxzCDxzCDabywabywzCDEzCDEbywFCDEqywFGDEqi";
int lengthC = sizeof(notesC);
int beatsC[] = { 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1};
int tempoC = 150;
void setup() {
pinMode(speakerPin, OUTPUT);
pinMode(inputPin1, INPUT);
pinMode(inputPin2, INPUT);
Serial.begin(9600);
}
void loop(){
val1 = digitalRead(inputPin1);
val2 = digitalRead(inputPin2);
if(val1 == LOW && counter1 == 0) {
counter1++;
for (int i = 0; i < lengthA; i++) {
playNote(notesA[i], beatsA[i] * tempoA);
}
}
if(val1 == HIGH && counter1 == 1) {
counter1 –;
for (int j = 0; j < lengthA; j++) {
playNote(notesB[j], beatsB[j] * tempoB);
}}
if(val2 == LOW && counter2 == 0) {
counter2++;
for (int k = 0; k < lengthC; k++) {
playNote(notesC[k], beatsC[k] * tempoC);
}
}
if(val2==HIGH && counter2 == 1){
counter2=0;
}
else{ digitalWrite(speakerPin, LOW);
}
Serial.print(counter2);
}
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tone);
}
}
void playNote(char note, int duration) {
char names[] = {‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘x’, ‘a’, ‘z’, ‘b’, ‘C’, ‘y’, ‘D’, ‘w’, ‘E’, ‘F’, ‘q’, ‘G’, ‘i’ };
int tones[] = { 1898, 1690, 1500, 1420, 1265, 1194, 1126, 1063, 1001, 947, 893, 843, 795, 749, 710, 668, 630, 594 };
// play the tone corresponding to the note name
for (int i = 0; i < 20; i++) {
if (names[i] == note) {
playTone(tones[i], duration);
}
}
}
[/code]
The simple wire contact activation was converted to a switch using conductive thread stitched into the button holes and around the button. This way, the button itself acts as the switch.
For the demonstration, extensions were added out the legs where the audio would normally be wired directly into the Power Pants themselves.
This is the future of pants!
Clink is a ring in three different sizes. You can put the ring on a cup and when you do cheers the music change. I used the Adafruit Audio FX Sound Board.
I put musics in the sound board and name them with the given format.
This allows me to change music randomly. laser cut a acrylic sheet to make the ring and wraped it with conductive tape. when those rings meet. It starts the music.
The prototype model does not change music when I toast but I want to know if that is possible and how I can make that. Also, I wonder if the ring could have a battery and programed board inside so the real product could be a wireless.