6 Replies Latest reply on Oct 25, 2018 11:00 AM by supper_slash

# Arduino

Hey, everyone! I really need help. We just implemented a circuit that can count and subtract a number using LDR, 74ls192, 74ls47 and 7 segment but after implementing it doesn't work properly while in the simulation by using Proteus the circuit works well. So, we decided to use an Arduino. But I'm having trouble on how to program an Arduino! I'm new to it! The problem is how can I program a system that upon entering a miniature parking lot that has only 20 slots in the area and that can count 1-20 and upon leaving the area it should minus.

Sorry for the disturbance.

• ###### Re: Arduino

So what you are wanting the Arduino to do is keep track of how many cars have entered the "miniature parking lot", and as they leave lower the number, as more arrive ad to the number?

Is this correct? Also what Arduino are you using, and are you wanting to use an Arduino only? or do you wish to use the 74ls47 with the Arduino?

2 of 2 people found this helpful
• ###### Re: Arduino

Arduino Uno sir, but only counts from 0-20 slots. That would do sir with 74ls47.

• ###### Re: Arduino

it should count from 0-20 using 7-segment and LDR.

• ###### Re: Arduino

Run the LDR with the sense resistor into one of your analog channels as the input. Write code that samples the input - if it falls below a threshold then you increment/decrement depending on which LDR is triggered.

Keep the state of the parking lot in a variable. Decompose this variable into your two digits (e.g. x/10 = first digit, x%10 = second digit). Write the corresponding bits to your digital output pins where your 7-segment driver's A-B-C-D lines are hooked into. For two 7-segment digits driven by BCD, you'll need to use 8 digital output lines.

It's actually not difficult - there's quite a few tutorials on LDRs online. Most tutorials about 7-segment tend to drive the LEDs directly from the Arduino (which will need more lines), but if you understand how the BCD driver works, it's not hard (ABCD are your BCD bits - set the corresponding outputs using bit shifts and masks in your code).

- Gough

1 of 1 people found this helpful
• ###### Re: Arduino

thank you sir! it's quite helpful.

• ###### Re: Arduino

If you need any more assistance feel free to let us know.

I would be happy to help where I can.

1 of 1 people found this helpful