Arduino Code/Programming HELP

Hey, I need to make a program/code for my Arduino Mega for school. I never learned how to code/program because of Covid-19... So my question is, can some1 help me with the code or write the code for me? It would help me alot.

The project is a station that puts a cap on a bottle. We need to show the amount of caps in the "cap holder" on a LCD 16x2 display (with i2c). The caps will be counted using 2 "limit-switches / microswitches". So is the cap presses the first switch the LCD counts +1, if the second cap presses the switch, the LCD shows "2 Caps" etc...

When the cap hits the second switch the display should go -1.

There is a red LED that has to burn when there are 3 or less caps in the "cap holder".

I can't find the code or a similar code...

Thanks in advance :slight_smile:

You can use digitalRead() to read limit switches.

You can use pinMode() to set pins to input.

And the IDE comes with examples. You might want to study the debounce example to prevent a single cap from resulting in multiple counts and the LCD examples.

That makes no sense. If COVID restricted your activities, you should have had PLENTY of time to read, watch some videos, and do some coding/testing/debugging in your own. The whole point of school assignments is for you to LEARN something. Having someone else write code and give it to you acomplishes nothing of value.

I suggest you START learning. Read some tutorials, of which there are, literally THOUSANDS available. Download and install the IDE and type in and compile some examples. Buy an Arduino (they are only a few dollars), and RUN some code.

I would hope nobody here will simply GIVE you the code you want, but that they will wait until you make an honest effort to learn, and people here will then HELP you, but not do it for you.

Hello
At first draw a schematic with all compoents to be used and in the second step start to design and code a sketch simply.
Have a nice day and enjoy coding in C++.

Stopped reading right there.

You’re lucky! Because everyone else doing your course is in the same position…
It’s never too late to get started… make a start, explain what you’re thinking in the comments, and we can likely help push you along.