GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 14-Oct-2015, 06:10
axe34 axe34 is offline
New Member
 
Join Date: Oct 2015
Posts: 1
axe34 is on a distinguished road

Help with basic C code


Hi I need help to write code for the following:

I want to press + release button 1 (to start everything), then.....

if button 2 is not pressed down then command XXXXX is done


if button 2 is pressed down then we assess button 3:

if button 3 is not pressed down then command YYYYYY is done


if button 3 is pressed down then we assess button 4:
if button 4 is pressed down then we light an LED:

if button 4 is not pressed down then command ZZZZZ is done



I want to use pull down resistors so that button press = logic 1. Buttons 2,3,4 will have weights sitting ontop of them.
Any ideas? Thankyou!
  #2  
Old 15-Oct-2015, 10:56
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 6,160
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Help with basic C code


Quote:
Originally Posted by axe34
I need help
So...
I guess you are working on an embedded project, right?

Well...
For a reasonable expectation of reasonable help with fewest iterations from people who are willing, and might be able, to help, I respectfully suggest that you supply some information:

  1. Which chip? Vendor and specific device?
  2. What compiler? And what version number?
  3. What development environment? IDE? Command line with make? What?
  4. What hardware development platform? Vendor's development board? Third party development board? Handwired breadboard? Solderless breadboard? What?

Quote:
Originally Posted by axe34
... help to write code for the following:
What have you done so far? Show (at least) the code for your main() function that is the base from which you detect switch closures and execute the "commands."

Quote:
Originally Posted by axe34
I want to press + release button 1
What kind of switch? How about debouncing? That is: Is it debounced or is your software expected to debounce the switch closure and release events?

Quote:
Originally Posted by axe34
then.....


Then what?

Is the command functionality all in-line in main() or are there command functions that return to main() or what?

Is all if this stuff inside a big loop (maybe while(1){} or some such thing) so that the sequence can be repeated?

Or what?

Bottom line: Show us how you got started, and give some details about your setup and requirements. Maybe check a vendor-specific forum (rather than this somewhat workstation-oriented general purpose programming help forum) and see what other people have done with such projects.

I mean, it's always OK to ask, but in order to get meaningful information you have to give meaningful information.

At least that's the way I see it.


Regards,

Dave
__________________
Sometimes I just can't help myself...
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cheapest Comodo Code Signing Certificate at $70/yr from CheapSSLSecurity sslsecurity Webmaster / Web Designing Advertisements & Offers 0 12-Sep-2013 05:37
Whats wrong with C++ steamerandy C++ Forum 3 16-Jul-2013 04:42
Attractive and reliable THANKGIVING offers from KVCHOSTING KVChosting_ Web Hosting Advertisements & Offers 0 19-Nov-2012 04:48
Tired of bad service or dishonesty from your current Web host? DownTown-Host Web Hosting Advertisements & Offers 0 23-Aug-2012 06:29
Code Library Elmseeker PHP Code Library 0 13-Jan-2003 08:58

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 09:14.


vBulletin, Copyright © 2000 - 2017, Jelsoft Enterprises Ltd.