NIck Tinkham 12/23/09
/*
* Math is fun!
*/
#include "math.h" // include the Math Library
int a = 3;
int b = 9;
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() // we need this to be here even though its empty
{
}
This is a nifty little program where you enter the length of the legs on the triangle, and the Arduino will calculate its hypotenuse.
No comments:
Post a Comment