Making Things Interactive

January 28, 2008

Lady Ada tutorial

Filed under: 3: LadyAda Tutorials,Tiffany Yang — tyang1 @ 11:05 pm
Tutorial 4
 
/*
 * Drive size calculator!
 */

int drive_gb = 100;
long drive_mb;

void setup()                    // run once, when the sketch starts
{
  Serial.begin(9600);           // set up Serial library at 9600 bps

  Serial.print(“Your HD is “);
  Serial.print(drive_gb);
  Serial.println(” GB large.”);

  drive_mb = drive_gb;          // temp result is stored as long instead of int
  drive_mb = 1024 * drive_gb;

  Serial.print(“It can store “);
  Serial.print(drive_mb);
  Serial.println(” Megabytes!”);
}

void loop()                 // we need this to be here even though its empty
{

}

protoshield on top of microcontroller
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: