I only got into SIP :(... I should not complain because many others do not have this opportunity, and the project I am assigned to is still quite interesting... It is almost the entire summer, but I get to commute to UCSC and back, so I still get to work on my projects at home.
I also did not make Physics Camp, but that was kind of expected... I hope I got a Gold or Silver medal at least :/ (I got a silver, top 75)
When I am at home, there are many things to do
Formal 4 year plan for Science Club A
RISE Club activities F
College App essay practice A
RECORDER THINGY!!!!! I NEED TO GET IT WORKING >:O B
Pallet train track thing A
Imaging Joe's Trail (extended now holy crap its loooong) (update 2: FKKK SO LONG WTF ACTUALLY KMS) B
Squirrel deterrent for my dad's fruit tree F
Physics practice A
Establish a good sleep schedule A
Read some Chinese stories A
ENTER sign with phospholuminescence sheet thingy A
CS Club ideas for in-school competitions after server is fully understood (maybe push onto droplet / aws server) B
The art of losing isn’t hard to master;
so many things seem filled with the intent
to be lost that their loss is no disaster.
Lose something every day. Accept the fluster
of lost door keys, the hour badly spent.
The art of losing isn’t hard to master.
Then practice losing farther, losing faster:
places, and names, and where it was you meant
to travel. None of these will bring disaster.
I lost my mother’s watch. And look! my last, or
next-to-last, of three loved houses went.
The art of losing isn’t hard to master.
I lost two cities, lovely ones. And, vaster,
some realms I owned, two rivers, a continent.
I miss them, but it wasn’t a disaster.
—Even losing you (the joking voice, a gesture
I love) I shan’t have lied. It’s evident
the art of losing’s not too hard to master
though it may look like (Write it!) like disaster.
Mosfets are voltage controlled switches. They have three pins (from left to right): GDS (God Dammit, Satvik!)=> gate drain source. N-channel and P-Channel fets are different. P go to the positive terminal of a power supply, while N are placed on the ground logic level.
void setup()
{
Serial.begin(38400); //38400 debug, 31250 real (matches MIDI)
//set up the pins
for (int i = 1; i <= 10; i++)
{
pinMode(i, OUTPUT);
digitalWrite(i, LOW);
}
pinMode(AIR, OUTPUT);
//set up vars
action = 0;
note = 0;
velocity = 0;
}
void loop() {
if (Serial.available() > 0) // if theres data
{
incomingByte = Serial.read();//get data
/*long asdf;
asdf = Serial.parseInt();
incomingByte = LTB(asdf);
Serial.println(asdf);
Serial.println(action);
Serial.println(incomingByte);*/
if (159 >= incomingByte && incomingByte >= 144) //NOTE ON status
{
action = 1;
}
else if (143 >= incomingByte && incomingByte >= 128) //NOTE OFF status
{
action = 2;
}
else if (incomingByte >= 128) //some other status byte
{
action = 3;
}
else if (incomingByte < 128) //data byte
{
if (action == 1)
{
note = incomingByte;
action = -1;
}
else if (action == 2)
{
note = incomingByte;
action = -2;
}
else if (action == -1)
{
velocity = incomingByte;
playNote(note, velocity);
action = 1;
}
else if (action == -2)
{
velocity = incomingByte;
playNote(note, 0);
action = 2;
}
}
}
}
void playNote(byte n, byte v)
{
if(note <72 || note >94)
{
return;
}
if (v == 0) //if OFF
{
note = 95;//OFF note
}
if (note >= 72 && note <= 95) //WHEN ON
{
note -= 72;
for (int i = 0; i < 10; i++)
{
digitalWrite(i + 2, fingeringMatrix[note][i]);
}
}
if(v==0)
{
digitalWrite(AIR, LOW);
}
else
{
delay(30);
digitalWrite(AIR, HIGH);
}
return;
}
byte LTB(long e)
{
byte ans = 0;
int ansArr[8];
for (int i = 0; i < 8; i++)
{
ansArr[i] = (e % 2);
e /= 2;
}
for (int i = 7; i >= 0; i--)
{
ans += ansArr[i];
if (i != 0)
{
ans *= 2;
}
}
return ans;
}