Tag Archives: mount holyoke

Arduino 8 key piano

Hey friendos,

Today I’m gonna show you a tiny little thing I built during Jterm and only now got to post. This is a tutorial on how to make your very own very basic piano using Arduino. The diagram is a bit crowded but it’s really not that complicated to make. 

Image

 

You will need 8 resistors, 8 buttons, 20 wires, one piezo speaker. And your Arduino and bread board of course. 

The code for this is as follows:

int button_C = 2;
int button_D = 3;
int button_E = 4;
int button_F = 5;
int button_G = 6;
int button_A = 7;
int button_B = 8;
int button_Cup = 9;

int speaker = 13;

int buttonstate_C = 0;
int buttonstate_D = 0;
int buttonstate_E = 0;
int buttonstate_F = 0;
int buttonstate_G = 0;
int buttonstate_A = 0;
int buttonstate_B = 0;
int buttonstate_Cup = 0;

//NOTES         'c'  , 'd',  'e',  'f',  'g', 'a',  'b',  'C'
int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 }; //freq
int Cur_tone = 0;

void setup()
{
  pinMode(button_C, INPUT);
  pinMode(button_D, INPUT);
  pinMode(button_E, INPUT);
  pinMode(button_F, INPUT);
  pinMode(button_G, INPUT);
  pinMode(button_A, INPUT);
  pinMode(button_B, INPUT);
  pinMode(button_Cup, INPUT);

  pinMode(speaker, OUTPUT);
}

void loop()
{
	buttonstate_C = digitalRead(button_C);
	buttonstate_D = digitalRead(button_D);
	buttonstate_E = digitalRead(button_E);
	buttonstate_F = digitalRead(button_F);
	buttonstate_G = digitalRead(button_G);
	buttonstate_A = digitalRead(button_A);
	buttonstate_B = digitalRead(button_B);
	buttonstate_Cup = digitalRead(button_Cup);

	if((buttonstate_C == HIGH) || (buttonstate_E == HIGH) || 
		(buttonstate_G == HIGH) || (buttonstate_D == HIGH) || 
		(buttonstate_F == HIGH) || (buttonstate_A == HIGH) || 
		(buttonstate_B == HIGH) || (buttonstate_Cup == HIGH) )
	{ 
		if (buttonstate_C == HIGH)
		{
			Cur_tone = tones[0];
		} 
		if (buttonstate_E == HIGH)
		{
			Cur_tone = tones[1];
		}
		if (buttonstate_G == HIGH)
		{
			Cur_tone = tones[2];
		}
		if (buttonstate_D == HIGH)
		{
			Cur_tone = tones[3];
		}
		if (buttonstate_F == HIGH)
		{
			Cur_tone = tones[4];
		}
		if (buttonstate_A == HIGH)
		{
			Cur_tone = tones[5];
		}
		if (buttonstate_B == HIGH)
		{
			Cur_tone = tones[6];
		}
		if (buttonstate_Cup == HIGH)
		{
			Cur_tone = tones[7];
		}

		digitalWrite(speaker, HIGH);
		delayMicroseconds(Cur_tone);
		digitalWrite(speaker, LOW);
		delayMicroseconds(Cur_tone);
	}
	else //in case no button is pressed , close the piezo
	{
		digitalWrite(speaker, LOW);
	}

}

(adapted from godspeech.wordpress.com)
Advertisements

Photoshop Healing tools

Have you ever taken a really nice picture, only to discover in post processing that there were some dust specks on the lens? Or maybe there’s a whole object you’d like to be somewhere else. Whatever your issue, the quickest way of fixing is probably the Healing tool, instead of manually doing it with the brush tools. 

Image

 

Take this picture for example. Beautiful sky. Real nice. But, there’s some grey-ish specks all over the place. And a creepy looking Spongebob smiley face. 

In Photoshop, on the left vertical tool box menu, you will see a symbol of a bandaid. If you click the bandaid, a menu box will appear, with your options: the spot healing tool, the healing brush, the patch tool, the content aware move tool, and the red eye tool. In this tutorial I will be showing you how to use the Spot healing brush tool and the Content aware move tool. The latter is a new option for CS6 and it’s totally cool. 

Image

Using the Spot Healing Brush Tool is very easy. All you do is select the tool, and paint over the area you want to fix. Make sure the brush size is a little larger than the area you want to fix, but not too much. 

Image

 

Repeat this step for all the spots you have in your picture!

Content aware move tool comes in handy when you have something that you really want to be situated somewhere else in the photo. This is best achieved if the object you’re moving can suffer a bit of distortion (which tends to happen with the Content aware move tool.) and if you’re moving it to a similar background. 

Image

Let’s look at creepy Spongebob again. To move him around, all you have to do is select the Content aware move tool and start drawing your selection around him. As with the spot healing tool, make sure to leave yourself a little bit of a margin for easier blending. 

Image

 

 

Click it and drag it to wherever you want it to be positioned now.

Image

 

As you can see, the blending isn’t totally perfect and there’s distortion on the object. You can further fix the blending with the spot healing tool if you want. Again, this move tool is best used for things that can handle a bit of distortion. However, it’s a pretty neat tool to have when you think about the fact that before you had to use a whole lot of tools to get a similar result. Now it’s as easy as draw, drag and voila!

I hope you learned a new thing today and have fun using the Healing tools!