pin 13 not giving 5v

why does pin 13 measure 5v then when you connect to something that requires 5v at the other end it reads 3,3v

Probably depends a lot on what "something" exactly. There are so many somethings out there that it is hard to guess. Try a 1k resistor to ground. What is that voltage?

inline with the device

or how do i change the pin 13 in the sketch to pin 8 im real new to this any help would be appreciated its for a car pc project

Example...

digitalWrite(13,HIGH); ---> digitalWrite(8,HIGH);

What something are you trying to drive with 5V from this pin? They can sink (+5 source to PIN LOW) 200mA, but can only source (PIN HIGH to Gnd), 40mA. If your "something" needs more than this you will need to use some sort of external switching component.... Transistor, Relay, etc.

FYI on this forum... More data = more help!

wzaggle: They can sink (+5 source to PIN LOW) 200mA, but can only source (PIN HIGH to Gnd), 40mA.

Actually depends on the board that OP uses. For 328 based boards, the absolute max for thew processor for both sink and source is 40mA. Safe value for both sink and source is 20mA.

I’m using this for a touch screen overlay for a car PC I want to be able to activate it when I hit a button on the radio ,when I go into android mode

I'm using this for a touch screen overlay for a car PC I want to be able to activate it when I hit a button on the radio ,when I go into android mode

You should be able to drive an "enable" pin (or other control input) but you can't "power" anything (other than an LED) from an I/O pin.

To power your screen you'd have to add a MOSFET switch or so, and have this MOSFET controlled by the output pin.

wzaggle:
What something are you trying to drive with 5V from this pin? They can sink (+5 source to PIN LOW) 200mA, but can only source (PIN HIGH to Gnd), 40mA.

The datasheet does not say that IO pins can sink any 200mA. It shows limits for 2 kinds of pins.

The VCC and GND pins have 200mA DC Max.

The IO pins are 40mA DC Max.

It is also known here that AVR IO pins won’t take even close to Max for long. Go for smoke!

this is the screen witch is plugged into a odroid c2

https://imagizer.imageshack.com/v2/365x649q90/924/WXNwmo.jpg

it works fine but what i did was cut the black and red wire in the usb cord and ran it to pin 13 and ground so the arduino would turn it on when i hit my navigation button

what happened was i had a resistive 7 inch touchscreen which worked well with the arduino then i changed it to capacitive now it wont give 5v at the capacitive module it reads 3.3

now if i take it out of pin 13 and put it to the analog 3.3v pin it works but i want it to work when it is switched on via pin 13 or any pin which would turn it on

here's the wires to touchscreen

https://imagizer.imageshack.com/v2/1135x638q90/922/3e8vmx.jpg

this is the code

/*
Jaguar XJ X350/X-Type/S-Type head unit button matrix decoder and video selector, with steering wheel ladder resistor detection and HID keyboard output.

When NAV button is pressed, set output 13 high, set output 12 low, store state to EEPROM and send i2c command to change video input to HDMI.
If AUDIO, TEL, CLIMATE, MENU pressed, set output 13 low, set output 12 high, store state to EEPROM and send i2c command to change video input to VGA (RGBS).
If NAV button held for approx 2 secs, set output 13 low, set output 12 high, store state to EEPROM and send i2c command to change video input to VGA (RGBS).
If 'Skip Backwards' steering wheel control button pressed, send keycode 88 (KEYCODE_MEDIA_PREVIOUS) via USB.
If 'Skip Forwards' steering wheel control button pressed, send keycode 87 (KEYCODE_MEDIA_NEXT) via USB.
If in Android mode and NAV pressed, send 'SEARCH+N' keycodes via USB (configure App shortcuts in Android with 'am start -n com.android.settings/.Settings\$QuickLaunchSettingsActivity' in a terminal)

Set serialDebug=1 to send debug messages via serial connection.

NOTE: You need to install the HID-Project library into the Arduino IDE for this to compile correctly

Version 1.5 - Uses new HID-Project library for keyboard control.Also fixed problem where MENU button didn't switch to Jag mode 
Version 1.4 - Outputs keycodes for 'SEARCH+N' when NAV pressed and already in Android mode (run the following from Android terminal to set default app: am start -n com.android.settings/.Settings\$QuickLaunchSettingsActivity)
Version 1.3 - Last saved state restored correctly
Version 1.2 - Changed matrix to use Analog inputs instead of pull-down resistors, and adjusted loop and delay timings for more accurate button detection, and add output 12 for OEM IR touch matrix relay control 
Version 1.0 - First version with steering wheel control detection

Ben Willcox 2016
ben.willcox@willcoxonline.com
*/


//поддерживаемые команды //supported comands for i2c control of openrtd firmware
//rf00100 - AV1
//rf00101 - AV2
//rf00102 - HDMI0
//rf00103 - HDMI1
//rf00104 - VGA
//rf00200 - power off
//rf00201 - power on
//rf003xx - backlight control, Где xx = 0-99 уровень подсветки //0-99 backlight level
//rf00402 - включить OSD, отобразить тестовое сообщение  //switch on OSD and write test message
//rf00403 - osd off.
//rf00404 - вывести новое сообщение при включенном OSD. //write  new message when OSD on
//rf00490 - autolight on.
//rf00491 - autolight off.
//rf005xx - bright control, Где xx = 0-99 уровень яркости //0-99 bright level
//rf006xx - contrast control, Где xx = 0-99 уровень контраста //0-99 contrast level


#include <Wire.h>
#include <EEPROM.h>
#include <HID-Project.h>
#include <HID-Settings.h>

int serialDebug=1; // 1 = Debug info via serial connection

int sensorPin = A0; // Connects to steering wheel audio controls resistor ladder output
int CDplaying = A1; // Connects to 'CD Playing' output pin
int sensorValue = 0;
int CDplaying_state=0;

int column_1_state = 0;
int last_column_1_state = 0;
int column_2_state = 0;
int last_column_2_state = 0;
int column_3_state = 0;
int last_column_3_state = 0;
int column_4_state = 0;
int last_column_4_state = 0;
int row_a_state = 0;
int row_b_state = 0;
int row_c_state = 0;
int row_d_state = 0;

int NAV_counter = 0;
int last_output_state = 0;
int row_scan_delay = 1000; // in microseconds, delay after a column change detection before checking row values
int loop_delay = 0;  // ms
int NAV_hold_limit = 5;
int debounce_delay = 200;

define serial_name Serial

byte osd_status = 0; byte osd_x_h = 0; byte osd_x_l = 100; byte osd_y_h = 0; byte osd_y_l = 5; byte osd_col_h = 0; byte osd_col_l = 32; byte osd_size = 0x00; byte osd_colour = 0xE0; byte osd_background = 0x00; //в данный момент не поддерживается //currently unsupported

byte n = osd_col_l + 1;

byte osd_message = 0; byte osd_prepare_message = 0;

int incomingByte = 0; // for incoming serial data int controlword[] = {0, 0, 0, 0, 0, 0, 0, 0}; int controlact = 0; long f = 0; long ggg = 0; int g = 0; byte start_count; unsigned long time; unsigned long status_time_prev;

byte temp_send;

boolean i2c_received; byte command[8]; // byte answer[32]; // byte cur_page; int i2c_counter;

boolean osd_flag; boolean parking_flag; boolean climate_flag; boolean trip_flag; boolean time_flag; boolean cardata_flag; boolean generalcontrol_flag;

byte left_temp; byte right_temp; byte outside_temp; //outside temp больше 100 это отрицательные значения byte input_control; // 00 - оставить без изменения, 01-AV1, 02- AV2, 03- HDMI, 04- YPbPr, 05 - VGA byte power_control; // 00 -не менять, 01 - выключить, 02-включить byte backlight_control; //00 не менять, 01-101 = (0-100%) byte bright_control; //00 не менять, 01-101 = (0-100%) byte contrast_control; //00 не менять, 01-101 = (0-100%) byte autolight_control; //unchanged, 01 -on, 02-off.

byte last_power_satatus; //1=ON, 0=OFF byte last_input; //1=AV1,0=AV2,6=HDMI,7=YPBPR,9=VGA byte last_board_status; //1=AV1,0=AV2,6=HDMI,7=YPBPR,9=VGA

//-------------------------------------------------------------------------------------------------------- void setup() { Consumer.begin(); // Keyboard emulation Wire.begin(2); // join i2c bus with address #25 Wire.onRequest(requestEvent); // register event Wire.onReceive(receiveEvent); // register wire.write interrupt event Serial.begin(115200); // start serial for output

left_temp = 23; outside_temp = 101; right_temp = 23;

// initialize pins

pinMode(4, INPUT); pinMode(5, INPUT); pinMode(6, INPUT); pinMode(7, INPUT);

pinMode(12, OUTPUT); pinMode(13, OUTPUT); Serial.begin(115200); if (EEPROM.read(200) == HIGH) { last_output_state = LOW; set_high(); debug("Last saved state was HIGH"); } else { last_output_state = HIGH; set_low(); debug("Last saved state was LOW");

}; } //-------------------------------------------------------------------------------------------------------- void loop() { // serial(); check_buttons(); check_steering_controls(); } //-------------------------------------------------------------------------------------------------------- void requestEvent() {

//-------------------------------------------------------------------------------------------------------- void requestEvent() {

if ((answer[0] == 0xee) || (answer[0] == 0xe2)) { Wire.write(answer, 16); // respond with message } else if ((answer[0] == 0xe3)) { Wire.write(answer, n); // respond with message } else { Wire.write(answer, 8); // respond with message } } //-------------------------------------------------------------------------------------------------------- void receiveEvent(int howMany) {

while (Wire.available()) // loop through all incoming bytes { command[i2c_counter] = Wire.read(); // receive byte as a character i2c_counter++; // increase index by 1 } i2c_counter = 0; //i2c_received=1; process_command(); }

//------------------------------------------------------------------------ void CF_clear_osd_flag() { osd_flag = 0; debug("i2c clear osd_flag\r\n "); } void CF_clear_parking_flag() { parking_flag = 0; debug("i2c clear parking_flag\r\n "); } //------------------------------------------------------------------------ void CF_clear_trip_flag() { trip_flag = 0; debug("i2c clear trip_flag\r\n "); } //------------------------------------------------------------------------ void CF_clear_climate_flag() { climate_flag = 0; debug("i2c clear climate_flag\r\n "); } //------------------------------------------------------------------------ void CF_clear_time_flag() { time_flag = 0; debug("i2c clear time_flag\r\n "); } //------------------------------------------------------------------------ void CF_clear_cardata_flag() { cardata_flag = 0; debug("i2c clear cardata_flag\r\n "); } //------------------------------------------------------------------------ void CF_general_control_flag() { generalcontrol_flag = 0; debug("i2c clear generalcontrol_flag\r\n "); }

//------------------------------------------------------------------------ void process_command() {

//отображаем состояние питания если изменилось if ((command[0] == 0xe0) && (command[1] == 0x01)) { if (command[4] != last_board_status) { debug("board status = ");

last_board_status = command[4]; }

} //отображаем состояние входа если изменилось if ((command[0] == 0xe0) && (command[1] == 0x01) && (command[3] != last_input)) {

switch (command[3]) //1=AV1,0=AV2,6=HDMI,7=YPBPR,9=VGA { case 0: debug("input switched to AV2"); last_input = command[3]; break; case 1: debug("input switched to AV1"); last_input = command[3]; break; case 6: debug("input switched to HDMI"); last_input = command[3]; break; case 7: debug("input switched to YPBPR"); last_input = command[3]; break; case 9: debug("input switched to VGA"); last_input = command[3]; break; default: break; } }

if ((command[0] == 0xf0)) { //clear flag page

if (command[1] == 0xff) CF_clear_parking_flag(); if (command[2] == 0xff) CF_clear_trip_flag(); if (command[3] == 0xff) CF_clear_climate_flag(); if (command[4] == 0xff) CF_clear_time_flag(); if (command[5] == 0xff) CF_clear_cardata_flag(); if (command[6] == 0xff) CF_general_control_flag(); if (command[7] == 0xff) CF_clear_osd_flag(); } else if ((command[0] == 0xe0) && (command[1] == 0x01)) { //main data page cur_page = 1; command[0] = 0; command[1] = 0;

answer[0] = 0xE0; //page indicator answer[1] = parking_flag; //parking flag answer[2] = trip_flag; //trip flag answer[3] = climate_flag; //climate flag answer[4] = time_flag; //time answer[5] = cardata_flag; //car data flag answer[6] = generalcontrol_flag; // general control flag answer[7] = osd_flag; //reserved } else if ((command[0] == 0xe1) && (command[1] == 0x01)) { //send general control data cur_page = 2; command[0] = 0; command[1] = 0;

answer[0] = 0xE1; //page indicator answer[1] = input_control; //input 01=AV, 02=VGA answer[2] = bright_control; //bright answer[3] = contrast_control; //contrast answer[4] = backlight_control; //backlight answer[5] = 0x00; //saturation answer[6] = power_control; //on/off 01=OFF, 02 = ON answer[7] = autolight_control; //autolight control } else if ((command[0] == 0xee) && (command[1] == 0x01)) { //send parking data cur_page = 3; command[0] = 0; command[1] = 0;

answer[0] = 0xEE; //page indicator answer[1] = 0x33; //rear1 answer[2] = 0x22; //rear2 answer[3] = 0x11; //rear3 answer[4] = 0x44; //rear4 answer[5] = 0x55; //reserved answer[6] = 0x66; //reserved answer[7] = 0x71; //reserved answer[8] = 0x72; //reserved answer[9] = 0x73; //reserved answer[10] = 0x74; //reserved answer[11] = 0x75; //reserved answer[12] = 0x76; //reserved answer[13] = 0x77; //reserved answer[14] = 0x78; //reserved answer[15] = 0x79; //reserved

} else if ((command[0] == 0xef) && (command[1] == 0x01)) { //send climate data cur_page = 4; command[0] = 0; command[1] = 0;

answer[0] = 0xEF; //page indicator answer[1] = left_temp; //left temp answer[2] = outside_temp; //outside temp больше 100 это отрицательные значения answer[3] = right_temp; //right temp answer[4] = 0x00; //reserved answer[5] = 0x00; //reserved answer[6] = 0x00; //reserved answer[7] = 0x00; //reserved

} else if ((command[0] == 0xe2) && (command[1] == 0x01)) { //send osd config data cur_page = 5; command[0] = 0; command[1] = 0;

answer[0] = 0xE2; //page indicator answer[1] = osd_status; // answer[2] = osd_x_h; // answer[3] = osd_x_l; // answer[4] = osd_y_h; // answer[5] = osd_y_l; // answer[6] = osd_col_h; // answer[7] = osd_col_l; //reserved answer[8] = osd_size; //reserved answer[9] = osd_colour; //reserved answer[10] = osd_background; //reserved answer[11] = 0x75; //reserved answer[12] = 0x76; //reserved answer[13] = 0x77; //reserved answer[14] = 0x78; //reserved answer[15] = 0x79; //reserved } else if ((command[0] == 0xe3)) { //send osd data

command[0] = 0; command[1] = 0; n = osd_col_l + 1; answer[0] = 0xE3; //page indicator answer[1] = 0x57; //W answer[2] = 0x57; //W answer[3] = 0x57; //W answer[4] = 0x2E; //. answer[5] = 0x4F; //O answer[6] = 0x50; //P answer[7] = 0x45; //E answer[8] = 0x4E; //N answer[9] = 0x52; //R answer[10] = 0x54; //T answer[11] = 0x44; //D answer[12] = 0x32; //2 answer[13] = 0x36; //6 answer[14] = 0x36; //6 answer[15] = 0x32; //2 answer[16] = 0x2E; //. answer[17] = 0x52; //R answer[18] = 0x55; //U answer[19] = 0x20; // answer[20] = 0x54; //T answer[21] = 0x45; //E answer[22] = 0x53; //S answer[23] = 0x54; //T answer[24] = 0x20; // answer[25] = 0x4D; //M answer[26] = 0x45; //E answer[27] = 0x53; //S answer[28] = 0x53; //S answer[29] = 0x41; //A answer[30] = 0x47; //G answer[31] = 0x45; //E

} }

void check_buttons() { column_1_state = digitalRead(4); if (column_1_state != last_column_1_state) { if (column_1_state == HIGH) { //debug("COL 1 pressed"); delayMicroseconds(row_scan_delay); row_a_state = analogRead(2); row_b_state = analogRead(3); row_c_state = analogRead(4); row_d_state = analogRead(5); if (row_a_state == LOW) { debug("AUDIO pressed"); set_low(); delay(debounce_delay); } if (row_b_state == LOW) { debug("TEL pressed"); set_low(); delay(debounce_delay); } if (row_c_state == LOW) { debug("CLIMATE pressed"); set_low(); delay(debounce_delay); } if (row_d_state == LOW) { debug("FAN UP pressed"); delay(debounce_delay); } delay(loop_delay); } }

]

Pin 13 on Arduino has an onboard led attached. You power the pin, the led turns on. Gee, what could be draining the 5V?

in-credible

If you set pin13 OUTPUT LOW, the default state on startup until the pin is moded differently, it would suck >40mA of that 5V down for a brief time before the pin burns up. Don't want to find how long that takes? Stick a 10K resistor in that 5V line and sense with a different pin.

ill give that a try sorry for the lack of knowledge on arduinos ...il learning

how can i relocate it to a different pin in that sketch

GoForSmoke: \f you set pin13 OUTPUT LOW, the default state on startup until the pin is moded differently

Default state of all pins upon startup is INPUT.

1milenia: how can i relocate it to a different pin in that sketch

Just change the pin definition in your sketch. Too long to read (three messages, and you forgot the code tags!) - you did define it at the start of the sketch, I hope?

Nevertheless, PINS CAN NOT POWER STUFF. I hope you finally can get that around your head. What you are trying to do is a BAD, BAD IDEA. It may work for a bit - it may not work properly (as you see) - it may make your Arduino go in a puff of smoke.

If you must switch on/off your screen get a proper switch for that, like a p-channel MOSFET and do a high side switch.

could i hook a mosfet the way this guy has it on pin 13

https://www.youtube.com/watch?v=Lzxuro0Z2Ew

You better post a circuit diagram of how you intend to make the connection. I'm not interested in trying to analyse a video. Lots of such diagrams you can easily find on Google, just search for high side MOSFET switch.