Technology for everyone
- New Hope For Open Source Textbooks
- Archaeologists strike gold in quest to find Queen of Sheba's wealth
- Bringing a 50,000-ton forging press back to Life
- What to make of AT&T’s vanishing spectrum crisis | Broadband News and Analysis
- Piltdown Man: British archaeology's greatest hoax
- Nearly Continuous Ashfall Damages Forests Near Chile's Puyehue Cordon Caulle Volcanic Complex
- Quantum Entanglement Observed Macroscopically in Distant Diamonds | Beyond Science | Science | Epoch Times
- Russian Scientists Poised to be First to Reach Ice-Buried Antarctic Lake: Scientific American
- Article: Newfound Alien Planet is Best Candidate Yet to Support Life, Scientists Say
- The Dropa Incident: The Ancient Eastern Roswell | Beyond Science | Science | Epoch Times
- RT @SkyandTelescope: Tonight N. Americans have a rare chance to see really thin crescent Moon paired with Mercury low in west after suns ... 12 hours ago
- RT @Tech_Tidbits: Syrian live streamer killed after being watched by millions: Syrian citizen journalist Rami Ahmad Alsayeed was k... ht ... 1 day ago
- RT @Tech_Tidbits: Moon May Not Be As Dead As We Thought: rivin2e writes "It would seem our neighbor, the moon, has something hidde... ht ... 1 day ago
- RT @Tech_Tidbits: Physicists Create a Working Transistor From a Single Atom: stupendou writes "Australian and American physicists ... ht ... 3 days ago
- RT @BoingBoing: Cop spends weeks to trick an 18-year-old into possession and sale of a gram of pot http://t.co/pxb3bDxt 4 days ago
- Microsoft Slams Google on Patents
- The Pokemon Company issues statement on fake App Store game
- South African Fuel-Free Generator Preparing for Market
- Adobe lays out the future for Flash: a platform for the next 5-10 years.
- Google to Sell Heads-Up Display Glasses by Year’s End.
- 'Faster than light' measurement blamed on loose cable
- Ridiculous: A Loose Cable Caused Those 'Faster-Than-Light' Particles
- Leaked Facebook document reveals website's secretive and bizarre 'graphic content' policy. No sex, but crushed heads are OK.
- Google Fiber just got better? Big G asks for permission to provide video service to Kansas City -- Engadget
- If a Tesla Roadster EVs batteries go completely flat, it "bricks" it. $40,000 for the repair.
- New Hope For Open Source Textbooks
- Understanding Spanning-Tree Protocol
- Archaeologists strike gold in quest to find Queen of Sheba's wealth
- Bringing a 50,000-ton forging press back to Life
- What to make of AT&T’s vanishing spectrum crisis | Broadband News and Analysis
- Piltdown Man: British archaeology's greatest hoax
- Nearly Continuous Ashfall Damages Forests Near Chile's Puyehue Cordon Caulle Volcanic Complex
- Quantum Entanglement Observed Macroscopically in Distant Diamonds | Beyond Science | Science | Epoch Times
- Russian Scientists Poised to be First to Reach Ice-Buried Antarctic Lake: Scientific American
- VLANs and Trunking > VLAN Configuration
- Article: Newfound Alien Planet is Best Candidate Yet to Support Life, Scientists Say
- The Dropa Incident: The Ancient Eastern Roswell | Beyond Science | Science | Epoch Times
- Catalyst 2900 Series Configuration Guide and Command Ref - Switch Command Reference [Cisco Catalyst 2900 Series Switches] - Cisco Systems
- Real time footage of aurora shows them dancing and shimmering | Bad Astronomy | Discover Magazine
- This Week in Radio Tech 111 | TWiT.TV
Arduino ho!!
0This will be my first post about arduino although not my first program. I waited until I had done some basic stuff and had something interesting to say.
I have done the blink and press button to blink. I decided the one to post about would be my venture into functions.
I needed to be able to call functions to allow for a program that had more flexibility to it. To that end I made what is a simple program to raise and lower the brightness of a led over a flexible period of time. I am going to post the program with what I hope are copious notes to make it understandable. If you have any trouble with it just leave a comment and I will try to clear the fog.
Here it is:
/*
Pulse an led on a pin. Go from dark to full bright in a designated interval then back down to dark in the same interval
*/
int ledPin = 11; // led pin used for LED in entire program
int interval = 500; // interval for change in milliseconds, 1000 is one second up and one second down
int waitforit = (interval/255); //delay this much between each increment
void brightup () {
/*
this is the subroutine to raise the brightness from zero to 255 over a specific delay
brightness is declared and initialized in this function
waitforit was declared and initialized for the entire program first
*/
for (int brightness = 0; brightness < 255; brightness ++){
analogWrite(ledPin,brightness); //write the brightness value
delay(waitforit); // delay 1/255 of the interval to maximum brightness
}
}
void brightdown () {
/*
this is the subroutine to lower the brightness from zero to 255 over a specific delay
brightness is declared and initialized in this function
waitforit was declared and initialized for the entire program first
*/
for (int brightness = 255; brightness > 0; brightness — ){
analogWrite(ledPin,brightness); //write the brightness value
delay(waitforit); // delay 1/255 of the interval to maximum brightness
}
}
void setup () {
pinMode(ledPin, OUTPUT); //initialize ledPin for OUTPUT
}
void loop() {
brightup(); //call the brightup fuction to raise the led brightness from 0 to 255
brightdown(); //call the brightdown fuction to lower the led brightness from 255 to 0
}
This is it working