Parts Counter

Hi everyone, I'm working on improving my programming skills, Its a slow process. I'm trying to make a parts counter and having difficulty getting all my little bits of code to work together properly.

The goal is to be able to use a keypad to input a number to count up to. The count will need to be incremented by one every time a part breaks a light screen (laser emitter and LDR) and once the count equals the input value, an output needs to be triggered (buzzer, light, etc.).

One option I would like to have is a button to increment the count by one if more than one part is accidentally thrown through the light screen.

Any info or links would be greatly appreciated!

Welcome to the group.

We can help with this.

It is best you put together a sketch how you think this would be solved.

This will show us what you know.

When you run into problems, shout out for help.

Draw up and show us a good schematic of what you think the circuit would look like.

Here's the code I'm starting with for the counter. It seems pretty simple. I'm not sure but I think my next step will be to create a variable which represents the number that will be input from the keypad. (This is where I'm stumped). I'm having trouble applying the keypad input to change the amount of parts that need to be counted

The number from the keypad represents the amount of parts that need to pass through a break-beam sensor.

Once the correct number of parts pass through the break-beam sensor I need to create an output.

I also need to display the current count on a 16x2 lcd display but I'm fairly positive I will be able to accomplish this.

Parts_Counter_Attempt_2.ino (376 Bytes)

Why are you doing this project, is it home work or work for your home?

What hardware are you going to use, do you have?

THis is the code for the keypad I'm trying to use. It's the basic 4x4 membrane switch that comes in most kits

Keypad_Membrane_Switch.ino (935 Bytes)

Why are you doing this project, is it home work or work for your home?

What hardware are you going to use, do you have? Links?

This is a prototype for work. Some production workers here get parts orders of all different quantities and often need to count several hundred parts. I need to input the amount of parts to through the keypad, watch the count increment on a display and be able to increase the count if 2 get through the lightscreen at a time or decrease the count if some need to be removed.

The keypad is the standard 4x4 keypad that comes in most kits

Here's the breakbeam sensor: Overview | IR Breakbeam Sensors | Adafruit Learning System

LCD display is the standard 16 x 2 display

Output will just be standard LED

Button to increment and decrement count are standard non-latching buttons

What Arduino?

Which LCD display?

@BlueNick, it would help if you read the forum guides for posting.
While I don’t think we’ll see much in your initial sketch, most of us won’t see anything at all.
Use </> code tags to paste your sketch inline.

Also, you mention you have existing pieces of code lashed together.
Have you proven they all work by themselves?
Lumping them together won’t fix any individual issues.

Thanks, I'm new to the forum so I'm sure I'll improve with time.

All my code seems to work fine individually, I think I'm gonna try to get a little farther with it then post some better descriptions and code then go from there.

Thanks for the input

Also, I'm using an arduino uno r3

Assume you are set up something like this:

Sorry for my late reply, busy week. Yes Larry, that's exactly it!