Saturday, June 12, 2010

My first arduino attempt


with my first Arduino attempt, i messed around with button and a LED, its suppose to control the button LED functions with the simple press of the button that is stated from the reading "Getting Started with Arduino." After that, i uploaded a sketch example from the arduino program to make the led blink or stay on by command; by reading that, the sketch stated how to manipulate the LED function by changing its digital write (the actions of the LED) from the when it turns on and off as it blinks. by changing its actions, i messed around with its Delay numbers later learning that the LED's blink at a thousandth of a second.

//example of what i was messing with to command the LEDS with in the script thats written in RED

/*
Blink

Turns on an LED on for one second, then off for one second, repeatedly.

The circuit:
* LED connected from digital pin 13 to ground.

* Note: On most Arduino boards, there is already an LED on the board
connected to pin 13, so you don't need any extra components for this example.


Created 1 June 2005
By David Cuartielles

http://arduino.cc/en/Tutorial/Blink

based on an orginal by H. Barragan for the Wiring i/o board

*/

int ledPin = 13; // LED connected to digital pin 13

// The setup() method runs once, when the sketch starts

void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
}


the lower the number the faster the LEDs respond in turning on and off. the higher the longer is takes it to respond.



No comments:

Post a Comment