links · people · groups · tags | My: links · tags · groups · watchlists · notes login · sign up now! | help · blog
Simpy simpy
 
Michael Shook, member since May 27, 2004
.
Search Everyone: ("macro") not "free",

Top ("macro") NOT "free" experts: econnews, jafi, mimarko, webgeek, burkerz99, ibnelis,

1 - 1 of 1   Watch mshook
 
void setup(){
  pinMode(13, OUTPUT);
}
 
void loop(){
  digitalWrite(13, HIGH);
  delay(500);
  digitalWrite(13, LOW);
  delay(500);
}

First, we configure pin 13 for output by setting a bit in Data Direction Register B. Then we turn pin 13 by setting its bit in PORTB. Then we delay 500 milliseconds by marking the current value of timer0, converted into milliseconds, and letting the counter be incremented repeatedly at each clock cycle and overflowed into ever larger holders until the new value of timer0 represents an elapsed time of 500ms. Next we set the bit for pin 13 in PORTB low to turn the LED off. We do the delay dance again and we're home.

by mshook 2009-06-14 16:18 arduino · avr · how · code · c · microcontroller · good · long · macro
http://www.urbanhonking.com/ideasfordozens/2009/05/an_tour_of_the_arduino_interna.html - cached - mail it - history
1 - 1 of 1  
Related Tags
 
- exclude ~ optional + require
Add Dates