Loading...
Pages: [1]   Go Down
Author Topic: Coding help!  (Read 217 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

New to the Arduino software.
The Board we are using is the LilyPad Arduino w/ ATMega328.
We have 6 LEDs (3 red and 3 green) and a button.
We're trying to get the 3 red LEDs to light up when the button is clicked once, and if the button is pressed for more than 2 seconds, the green LEDs should light up.

We need the coding please! This is our first project and we need a jump start as time is low
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 43
Posts: 2518
"We're a proud service of the Lost Electricity Reclamation Agency"
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

We're trying to get the 3 red LEDs to light up when the button is clicked once, and if the button is pressed for more than 2 seconds, the green LEDs should light up.

Is that the extent of it?  Do any LEDs ever go off?
Logged

Get the infamous "One Million Ohms" board at tINDIE.com: http://tinyurl.com/BuyMohms

New Hampshire
Offline Offline
God Member
*****
Karma: 13
Posts: 776
There are 10 kinds of people, those who know binary, and those who don't.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

We need the coding please! This is our first project and we need a jump start as time is low

That's not really what this forum is for.  It's for helping people with particular problems with their code, not providing code for them.  See this post: (sticky) http://arduino.cc/forum/index.php/topic,97455.0.html  In particular, items 6 and 10.

That being said, the Arduino already provides a fairly comprehensive set of example sketches showing basic functionality of nearly all it's features.  Spend a few minutes looking through them, and you'll likely find a lot of what you're looking for.
Logged


Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 249
Posts: 16572
Available for Design & Build services
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Go do some reading in the Learning section. Start with declaring IO pin, setting them up as inputs & outputs,
add Debounce of a button, then add checking for time passage using millis.
What you are after is pretty basic.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@OP
To save your inevitable embarrassment,  I've deleted your duplicate cross-postings.
Cross-posting wastes time, and I'm sure you wouldn't want that.
Logged

Pete, it's a fool looks for logic in the chambers of the human heart.

Pages: [1]   Go Up
Print
 
Jump to: