Make a tumblr. Email me the link.
Draw a circuit that connects a battery to a switch to an LED. Post the drawing to your tumblr.
What we did in class (if you were not there please install Arduino):
Installed the Arduino IDE
wrote a blink sketch, wrote a dimming sketch, make a simple circuit with a light sensor as a control for an LED.
Code with comments uploaded and also below:
// int stands for a variable that will hold a whole number
int ledPin = 13;
// a single = assigns a value to the variable (var) preceding it.
int delayVal = 1000;
//All vars declared outside the scope of a function are global
void setup() { //void setup() indicates we are writing a function. Arduino knows to only run this function once
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT);//pinMode() is a function built into arduino
//OUTPUT sets the pin to a output rather than an input.
// when a var is in ALLCAPS it is a constant, meaning it will not ever change it's value.
}
void loop() { //Arduino knows to run this continually
// put your main code here, to run repeatedly:
//digitalWrite turns things on or off aka 0 or 1
digitalWrite(ledPin, HIGH); //another predefined function, which we are passing two values
// HIGH sends voltage to the pin
delay(delayVal);//this function only accepts one value
digitalWrite(ledPin, LOW);
//LOW turns off voltage to the pin
delay(delayVal);
}