Give binary values to my arduino inputs

Hi everyone.
Can i inject 5V to my arduino Uno input so to get logic value = 1 to it ? do i need to add anything else (Resistances/ diodes ...)
Please see below a screen shot (dip-switch-8 connection).

The normal way to wire buttons to the Arduino is to arrange that when the button is pressed the input pin is connected to GND. In the pinMode() for the button pin you use INPUT_PULLUP as the mode to activate the built in pullup resistor of the pin. As a result, when you read the state of the pin with digitalRead() it is LOW when the button is pressed and HIGH when not. You then use the logic of the sketch to whatever action you require

Why do you want to "inject" 5V into your Arduino ? What are you trying to do ?

Yes - just make sure the pins really are INPUT first. If the pin is an OUTPUT and LOW then you create a short and magic smoke will destroy the pin and/or the arduino.

I would advise to connect buttons to GND and use the INPUT_PULLUP capabilities of the pins so that you never find yourself in the risky situation

Thank you so much.
Ithink a magic smoke is a good idea it makes things more funny :sweat_smile:

It’s useful once may be to learn a lesson :slight_smile:

(And learning from the experience of other is even better - If we can avoid polluting the planet with trashed electronic equipment…)

@hosninfogate
For your set-up, the safest/easiest way to do it is to connect the DIP switches to GND and set the input to INPUT_PULLUP

I was just speaking generally: Learning is a part of life. Making mistakes is also a part of life.
For sure we would like to avoid mistakes by learning from others That is why i'm asking and i'm here in this Forum.
Since you are here can you help me please. I would like to give you the story behind my question.
Ok do you remember or have any idea of the Atari games console / Nintendo…?

You plug a cassette into the console you get a game

You plug another one you got another one.

I’m trying to make plug and play module (a kind of cassette)

I have like 9 topics. For each one you need to plug a kind of cassette that contains random 6 answers (6 Buttons) and you have to choose the right answer. If you make a wrong answer then an audio voice will correct you (Each topic has a voice correctionà 9 Audios)

The idea is to use a combination of bites for example

1111 à Play sound 1 for topic 1

0111 à Play sound 2 for topic 2

And so on...

Of course, I can use buttons / sensors. but I prefer to avoid a lot of mechanics and make a specific wiring inside the cassette in a way I got a specific circuit between the cassette and the console when it’s plugged (Using DB connectors) . Some picture may be:

Hi Jim-p
Thanks for the tip

In fact i don't really going to use the Dip. I'm going to connect these inputs by pluging each time a kind of cassette in a way tha tyou create an internal specific circuit with the arduino board for each cassette .
Each cassette pluged need to produce a specific voice. (I need 9 voices/9 cassets)
so if i use 4 inputs and play with the binary combination i can trigger in my code 9 combination each combination i play a wave Audio.
More details in the post --> Give binary values to my arduino inputs - #7 by hosninfogate

A Cassette with pins connected to GND will also work, just make sure there is a GND connection between the cassette and the Arduino GND

can not follow you
can you make ythe change directly in my circuit and show me?
Thanks.

NB: Imagin that the Dip is a connection between a male and femle DB connectors
The male is connected to the cassette the other one is wired to the Arduino board.

Make it the same way as you do with your buttons. They are all connected to Gnd. When plugging your cassette in it is the same as pressing buttons down..

6 buttons on a board could just be something like this

you hook them up to 6 pins set as INPUT_PULLUP and connect the GND as well to the board.

button libraries such as Button in easyRun or OneButton or Toggle or EasyButton or Bounce2, ... can read those easily

where do you store the business logic for your questions / answers ?

I change it

Sorry i can not see any changes
May be you can make a copy of my project mke chnges and send me the link.
Thnks.

I can't make changes to your project because it is private, I saved a copy

Link to the copy please

Hi,

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Fritzy images do not necessarily convey the signal process of your circuit and you are restricted in component symbols.

If you use any CAD program, you should be able to EXPORT a jpg or png image, rather than a screen capture.

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

Hi Tom
can you first try this?

Have no idea where it is saved.

just click on share button and you will get a link.

Thanks a lot.