Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!




Arduino and buttons
 
Share:
Notifications
Clear all

Arduino and buttons


(@wafray)
New Member
Joined: 8 months ago
Posts: 1
Topic starter  

Hi to everyone,

I make a device that will count how many vehicles have passed per hour or a specific set time.

The scheme includes: Arduino Uno, differential pressure sensor, LED LCD, memory card module, battery and cables for the connection between the modules.

I want to ask: Is there a way to make the Arduino UNO reprogram by pressing a different button for my different needs? And for help how to connected this buttons with Arduino to work- scheme ? 

For example :

Today from 6 am to 12 I want the device to count only 2 wheeled axis, and then 4 axis vehicles or 6 wheeled axis vehicles. I need advice on the hardware, how to connect them to the Arduino if I have switches.

PS : Without RTC- it's too complicated!

Thank you! 


ReplyQuote
 Hans
(@hans)
Noble Member Admin
Joined: 8 years ago
Posts: 2027
 

Hi Wafray,

I haven't worked with a setup like that, but it sounds like this article may be a good starting point LED Effects All-in-One.

I know this is not what your project will be doing, but the attachInterrupt() function is used to trigger an interrupt when pressing a button.
In the meanwhile a value is stored in the EEPROM to keep track of the function you'd like to be using (or in that project: the selected LED effect).

Start reading at Challenge 2 and keep reading until you've completed reading Challenge 5 in that article.
It may be a solution for your "reprogram" question.
Based on the value in the EEPROM certain code can be selected, as seen in the LED effects example.

I hope this helps you get started 😊 


ReplyQuote
(@stockvu)
New Member
Joined: 4 months ago
Posts: 1
 

Today from 6 am to 12 I want the device to count only 2 wheeled axis, and then 4 axis vehicles or 6 wheeled axis vehicles. I need advice on the hardware, how to connect them to the Arduino if I have switches.

You could use the Arduino Time Library to decide what time it is, just need some buttons to set the time. If you lose power, then you need to set the Time again -- so that's the drawback without using an RTC-module.

With either switches or push-buttons, you always have the need to debounce contacts. So, there's a library you can use to support buttons and switches including debounce. You'd just connect wires to GND and a port-pin (per item). That should help a lot with interfacing to your sensors.

hth


ReplyQuote

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: