Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Problem with digitalRead() on: February 10, 2013, 04:50:51 pm
Thank you very much to all, I resolve my issue with information of this link http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

2  Using Arduino / Programming Questions / Re: Problem with digitalRead() on: February 10, 2013, 04:00:30 pm
Hi AWOL

I connected resistor to PIN 7 but the problems don't disappeared..
3  Using Arduino / Programming Questions / Re: Problem with digitalRead() on: February 10, 2013, 03:33:57 pm
Thanks for your answers, but I think I'm not explaining very well..

Imagine my board without anything... in this case, digitalRead() always return me "0", but when I connect one piece of cable (only the cable) to PIN 7 (remember, is INPUT) my Arduino returns me alternatively "0" and "1" (even without closing the circuit)

In this way...

if PIN 7 still do not receive voltage.. Why do I need the "resistance"?

if PIN 7 will be returns 1 or 0 (representing HIGH or LOW), Why do I need float variable?

I'm confused..

Thanks a lot!!!
4  Using Arduino / Programming Questions / Problem with digitalRead() on: February 10, 2013, 02:54:21 pm
Hi everybody,

I'm trying to make very simple exercise with my Arduino UNO. Basically, I'm trying to read the pulsation on button but I've run into an error I do not understand.

I'm trying to explain...

My Design is like this:

3.5 v output ------ cable ------ button ------ cable -------- PIN 7

And my code is like this:

Code:
void setup()
{
pinMode(7, INPUT);
}

void loop()
{
delay(100);
int x = digitalRead(7);
Serial.print(x);

}

If I don't push the button, I will receive "0", however, if I push the button I will receive "1".... yes?

But... without touching anything... the "Monitor serial" always shows me alternatively 0 and 1... 6 or 7 times each... like this example:

Code:
x: 1
x: 1
x: 0
x: 0
x: 0
x: 0
x: 0
x: 0
x: 1
x: 1
x: 1
x: 1
x: 1
x: 1
x: 1
x: 0
x: 0
x: 0
x: 0
x: 0
x: 0
x: 0
x: 1
x: 1
...

If I touch the button, the "x" value, evidenty, force change to "1"... but the other times... What happens???

I do not understand why this problem happens.

Thanks in advance for your comments.

Moderator edit: topic subject corrected
5  Using Arduino / Sensors / Arduino UNO and ADXL 345 Accelerometer on: November 17, 2012, 11:56:22 am
Hello to community,

I was bought this accelerometer in DX.com

http://dx.com/p/adxl345-digital-3-axis-gravity-acceleration-sensor-module-blue-149476

But I don't know how connect it correctly with Ardino UNO board...

This is a shot of my protoboard with all elements:





Red cables are 3.3v
Blue cable are ground
Yellow cables are A4 and A5 connections

I got this design from http://bildr.org/2011/03/adxl345-arduino/  and http://arduino.cc/forum/index.php?topic=97486.0 (the connections are from latest web)



And.. this is my code...

Code:
void setup()
{
  Serial.begin(9600);    
  pinMode(A4, INPUT);
  pinMode(A5, INPUT);
}

void loop()
{
  Serial.println(analogRead(A4));
  Serial.println(analogRead(A5));

  delay(1000);
}

(Evidently, this code is very simple but i think is correct)

Every second, I receive the same numbers from A4 and A5 pin (although I move the accelerometer)



What is wrong?

Thanks in advance for you help (I'm very very begginer)
Pages: [1]