Beginners Simple problem

I have a rotary switch set up as an input to the arduino to control which channel the software selects. This causes various outputs (20 or so) to be set either HIGH or LOW.

For some reason, four voltages are being outputted by the board, 0V, 1.4V, 3.6V and 5V where I was only expecting 0 and 5. Depending on the channel 1.4V and 3.6V can be used either as the high or low voltage.

My board is an arduino 1280 mega and is only using digital pins. I have tried powering it from both the USB and the Power Pack and this makes no difference.

Can anyone help?

Cheers,
Leanne

Maybe some digital pins have a load that is too high attached to them, so the output voltage lower than 5V ?

Each pin can achieve up to 5V and does when different channels are selected. The only thing the switch changes are which ones are on/off. There's 5V going through the switch into the arduino, should this be changed?

Are all the pins actually set to OUTPUT mode? If not, this can cause the pin voltage to actually be less than 5V.

Are any pull-up resistors enabled? That can also drop the measured voltage.

There's 5V going through the switch into the arduino, should this be changed?

Reducing the voltage is fine. Increasing it will cause permanent damage.

Yes they are and No there's no pull-up resistors. I've ran this code before and it worked fine, however I had to change some of the pin numbers so that the whole thing would be easier to assemble. This is a new problem

Each pin can achieve up to 5V and does when different channels are selected. The only thing the switch changes are which ones are on/off. There's 5V going through the switch into the arduino, should this be changed?

So you see voltage drops when multiple channels are ON, while when only one channel is ON you see 5 V ?

Sorry i explained that poorly, only one channel can be selected at once.

E.g in position one, the switch will input 5V to the arduino and the outputs will have a low voltage of 0V and a high of 1.4V
in postition 2, HIGH= 3.6 LOW =1.4V
in position 3, HIGH=5V LOW=3.6V

can you help?

I'm sorry, too few details for me. I don't understand. I think you should post the circuit diagram and code (if relevant).

I understand even NOTHING (which is rare...). Please help solve the confusion.

Whatare the items in the first place?
What is connected where in what way?
What is the program code?

This problem can most likely be solved in 10 seconds with A LITTLE BIT of precise information..

Sorry i explained that poorly,

You still are explaining it poorly. We need a schematic. It sounds like you are doing something quite silly like feeding 5V directly into an output pin.

Digital pins 7-0 and 14 are connected into a 9-way rotary switch. The switch has 5V input . These are set as INPUTS.

Odd numbered pins 25-53 are set as outputs and are connected up to a D type connector socket. (currently unattached to anything else).

An if statement controls the outputs depending on the switch input setting each output pin either high or low.

thats the circuit.

So when the switch is not connected to an input pin nothing is. That is wrong. You need either:-

  1. A pull down resistor of 1K on each of the input pins
    or better
  2. Connect the common switch connector to ground (instead of +5) and enable the internal pull ups on the input pins.

connecteing the other pin of the switch to ground changes nothing, I've tried it. Also the switch must always be connected to one of the pins. The resistors only make the problem worse.

What are you doing??? I don't see it....

...in position one, the switch will input 5V to the arduino and the outputs will have a low voltage of 0V and a high of 1.4V
in postition 2, HIGH= 3.6 LOW =1.4V
in position 3, HIGH=5V LOW=3.6V

What do you want to say by this? Which of the 9 outputs?

What i was trying to say was that high should be 5v and regularly isnt, low should be 0v and regularly isnt. No pin is consistent in its high and low voltages.

It has been fixed now by simply not having a switch over pins one and zero which seemed to be screwing the thing up to high hell.

connecteing the other pin of the switch to ground changes nothing, I've tried it.

Then you haven't tried it right. Go back and see exactly what I said.

The situation you describes has floating input pins, you might think you have fixed it but you haven't if you still have floating input pins. It just happens to work.
Were you using a digital meter to measure the output voltage, it could be that it is oscillating and thus giving you a reading between 0 and 5v. It could be oscillating BECAUSE you have floating pins.

Were you using the serial port in your program Leanne? If so that could be your main problem. Pins 0 and 1 are the hardware serial pins though they can be used as digital pins as long as serial is not used.