This is the programming that I used in order to write the Pythagorean theorem.
#include "math.h" // include the Math Library
int a = 3;
int b = 4;
int h;
void setup() // run once, when the sketch starts
{
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Lets calculate a hypoteneuse");
Serial.print("a = ");
Serial.println(a);
Serial.print("b = ");
Serial.println(b);
h = sqrt( a*a + b*b );
Serial.print("h = ");
Serial.println(h);
}
void loop()
{
}
Monday, September 29, 2014
Monday, September 22, 2014
Code for Blink Modification
Here is the code I used for the Blink Modification.
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(100);
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(100);
Code for "There and Back Again: For Loop"
Here is the code that I used in the For Loop to make the LEDs light there and back again.
void loop()
{
for (int led=13; led>=3; led--)
{
pinMode (led,OUTPUT);
digitalWrite (led, HIGH);
delay (100);
digitalWrite (led, LOW);
}
for (int led=3; led<=13; led++)
{
pinMode (led, OUTPUT);
digitalWrite (led, HIGH);
delay (100);
digitalWrite (led, LOW);
}
void loop()
{
for (int led=13; led>=3; led--)
{
pinMode (led,OUTPUT);
digitalWrite (led, HIGH);
delay (100);
digitalWrite (led, LOW);
}
for (int led=3; led<=13; led++)
{
pinMode (led, OUTPUT);
digitalWrite (led, HIGH);
delay (100);
digitalWrite (led, LOW);
}
Wednesday, September 10, 2014
Unit 3: Introduction to Arduino/Blink
-Rebecca
Subscribe to:
Posts (Atom)