Generally you will need to provide some sort of voltage divider for each signal you want to bring to the Arduino. To determine the values of the resistors you'd first need to know the maximum voltage your bike's electrical system will get up to (but just a 10K trimpot would do). What are you wanting to do with the Arduino?
wholeo:
so I can connect: brake light -> trimpot -> arduino input pin?
I suggest that it would be better to use plain old resistors rather than a trimpot. A trimpot has an infinite number of wrong settings, and could easily be set wrong or disturbed by accident, and they're mechanical devices which aren't particularly robust. All you need is a pair of resistors in series, and you can easily calculate the ratio of resistances you need to produce your required output voltage range. I suggest you design for an input voltage of around 15V (to allow for the full range of voltages typically seen in car electrical systems) which conveniently means you just need to reduce the voltage by a factor of three - any three identical resistors in series will do that for you.
@PeterH - thanks for the info! I will give that a go. I've created a rough schematic. Is this how it should go?
Possibly with code similar to this:
int ledPin = 13; // LED connected to digital pin 13
int inPin = 7; //or A0? // brake light connected to input pin (digital or analog??)
int val = 0; // variable to store the read value
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output
pinMode(inPin, INPUT); // sets the digital pin 7 as input
}
void loop()
{
val = digitalRead(inPin); // read the input pin
digitalWrite(ledPin, val); // sets the LED to the inPin value
}
Please don't connect an LED directly between an I/O pin and ground without a current-limiting resistor - you risk damaging the LED and/or the I/O pin. In any case there is already an on-board LED connected to pin 13.
The resistors shown are not connected correctly. You need to have the three resistors connected in series (you have that part right). One end of this chain need to be connected to ground. The opposite end needs to be connected to your 12V signal. (This means the signal is grounded through your three resistors.) The Arduino's ground needs to be connected to the 12V ground, too, to complete the circuit.
With the connections described above, you now have two intermediate junctions between the three resistors. The one closest to ground will see one third of the 12V signal. This is the one you want to connect to the Arduino's input pin. Check the actual voltage here before you plug it in to the input pin since a mistake in the circuit could cause this to be above 5V in which case it would damage the Arduino.
Connect the three resistors in series. This gives you two end points and two intermediate junctions.
Connect one end to Arduino ground, which should also be connected to vehicle ground.
Connect the other end to the 12V signal provided by your switch.
Connect the Arduino input to the intermediate junction which is closed to the ground end. Before making the connection, measure the voltage at this junction and confirm that it is 5V or less.