Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Re: [solved] INPUT always high on: January 04, 2013, 06:46:58 pm
Im not using pin 0/1 though, Im using pin 2/3 which is interrupt 0/1
2  Using Arduino / Project Guidance / Re: [solved] INPUT always high on: January 04, 2013, 04:59:28 pm
I see what you mean when looking at http://arduino.cc/en/Hacking/PinMapping2560

I wish the attachInterrupt() page on arduino.cc mentioned this, could have saved some time, oh well lesson learned.

next is pin 2/3 int 0/1 Im seeing a similar issue.

int0 - pin2 is low
int1 - pin3 is high

looking on the pinmapping page I dont see anything obv about why this would be happening. Any idea's  ?

Code:
int a_int = 0;
int a_pin = 2;
int b_int = 1;
int b_pin = 3;

void a_switch() {
Serial.println(digitalRead(a_pin) ? "a = H" : "a = L");
}

void b_switch() {
Serial.println(digitalRead(b_pin) ? "b = H" : "b = L");
}

void setup() {
  Serial.begin(115200);
  pinMode(a_pin, INPUT);
  digitalWrite(a_pin, LOW);
  attachInterrupt(a_int, a_switch, CHANGE);
  pinMode(b_pin, INPUT);
  digitalWrite(b_pin, LOW);
  attachInterrupt(b_int, b_switch, CHANGE);
}

void loop() {
  delay(1000);
}

tried without the digitalWrite(a_pin/b_pin, LOW) as well.

Thanks again guys,

UDL
3  Using Arduino / Project Guidance / Re: [solved] INPUT always high on: January 04, 2013, 04:02:57 pm
its a 2560

In the future I'll make sure to look for that, Thanks

UDL
4  Using Arduino / Project Guidance / Re: INPUT always high on: January 03, 2013, 06:59:41 pm
ok resolved, kinda

works fine on pin 19 but not on pin 20

atmega2560
5  Using Arduino / Project Guidance / Re: INPUT always high on: January 03, 2013, 06:02:22 pm
the 18v gnd is attached to the arduino's gnd
6  Using Arduino / Project Guidance / Re: INPUT always high on: January 03, 2013, 06:01:17 pm
Code:
void setup() {
  Serial.begin(115200);
  pinMode(20, INPUT);
}

void loop() {
  delay(1000);
  Serial.println(digitalRead(20));
}

Im getting 2.5v measured on the input with no voltage applied to the divider, and 5v at the input with nothing at all attached, telling me there is probably a 10k resister being used as a pullup ? Im guessing, 10k/10k would devide 5v to 2.5v
7  Using Arduino / Project Guidance / [solved] INPUT always high on: January 03, 2013, 04:28:28 pm
Im sure this has been asked before but such common search terms made it impossible for me to find anything related.

First off I'll admit im new to microcontrollers and this whole idea that an INPUT supplies the +5v baffles me. I guess it works for simple switch's at stuff but I just dont understand how to make it work for anything else.

my simple project uses a voltage divier from two resisters attached to an INPUT to tell if the voltage from the divier is +5v or not.

gnd --- 10k --- INPUT --- 40k --- 18v

if 18v is present I should get 4.5v on the INPUT, if 18v is not present I'll obv get 0v this works all fine and dandy with the multimeter until I attach it to the arduino, because the INPUT supplies 5v. this seems super odd to me, shouldnt an INPUT read a voltage level ? not supply it ? seems more like the job of an OUTPUT.

never the less, can someone help an idiot like me understand this ? how do I get the INPUT to stop supplying 5v OR if thats not possible then how do I fix my circuit so it does what I want lol

Im confused

UDL
8  Development / Other Software Development / MSTimer2 and the Arduino 2560 (UNO Mega) on: February 13, 2011, 06:52:10 pm
it appears as if the MsTimer2 lib hadnt been updated for the new hardware, the changes were trivial

http://updatelee.com/src/MsTimer2.cpp.patch

hopefully someone can look that over and confirm its all good. It does work on my 2560
Pages: [1]