How do I create a point system for a flipper game

Hi I'm making a flipper game and i am done with the frame, now the only thing i need to do is program a point system för it. I have sensors inplanted in the game board that detect whenever something has moved on top of the sensor. Now all i need to do is program a point system that gives you points every time the ball triggers a sensor, I also need to display it on a screen. I have one of the sensors set up at the end of the board which makes you see that you have lost and need to start againt. Any help?

"flipper" as in "pinball"?

Add a variable to your code to keep track of the points. If a certain sensor is activated, increment the counter by 1. For another sensor, you can increment by e.g. 2 or 5.

Depending on sensor type (you don't mention what those sensors are, they may bounce in which you will need to implement a debounce.

Hi, @saladadiga
Welcome to the forum.

Can you please post link to data/specs of the sensor?
What model Arduino are you using?

Have you written any code?
If so can you please post it?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

  1. Detect the sensor that was contacted.
  2. Debounce the sensor so only one contact event is counted.
  3. Accumulate contact events in multiple variables or an array.
  4. Display the variables or array.

Yes a pinball machine!
The problem is i have no code yet but i imagine it is a simple one that i need. The sensors i have are inductive sensors that constantly emitt about 20 volts. When a metal ovject either touches the top of the sensor or is really close to it the sensor sends out 0 volts as a sign that something has been activated.

Here is the link to the sensors that i bought. I have not written any code but i am planning on doing it soon. I will post the pictures of the screen i wish to use as well.

If they give an output of 20V, you will need a voltage divider as mentioned in (LJ12A3-4-Z/BX inductive approximation sensor).

You can read them like you would e.g. read a button.

It always looks easy, it hardly ever is. Reading one sensor is easy, reading e.g 100 sensors properly will need thinking; adding a screen (you don't mention which one) will require more thinking.

Which board are you planning to use, how many sensors and and which display?

what do you mean by debounce? I

I am planning on trying to code today and setting a mini beta version of the pinball up with 1 sensor a screen and the arduino. I can send you pictures of everything i am going to be using and explaining which sensors give how many point and which return something.
ps. I knew about the voltage divider i just forgot to mention it

Debounce is a standard reference to ensuring a button press is not registering electrical disturbances. Here is a simulation of two buttons, one is debounced, the other is not.