How can i branche the sensor and the programmation is wht ??
ok i will read about you have sending me . i have a picture about my sensors look at that
The link i've posted earlier will help you..
i have done this code and it put always 14 in monitor and i change place the same
int sensorValue = A0;
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
pinMode(sensorValue, INPUT);
}
void loop() {
// read the input on analog pin 0:
digitalWrite(sensorValue, LOW);
Serial.println(sensorValue);
delay(1000);
}
int sensorValue = A0;
A0 is #define'd to 14. So A0 in your code is replaced by 14.
Serial.println(sensorValue);
So this line prints 14 just like it is supposed to.
You have A0 set as an INPUT, so this line:
digitalWrite(sensorValue, LOW);
turns off the internal pullup resistor. You can't output on an input pin.
If you want to read the state of pin A0, try using digitalRead or even analogRead since that is an analog pin.
Serial.println(analogRead(A0));
gives you a print of the analog reading from the A0 pin.
Perhaps you should work through some of the example sketches and read through some of the reference material before you try to go any further. You need to first get a basic understanding of how things work on an Arduino before you go trying to hack and guess your way into a program.
// read the input on analog pin 0:
digitalWrite(sensorValue, LOW);
I just caught the comment there. Do you really think they would have named the function that READS a pin with a name including the word WRITE?
mnayra:
i have done this code and it put always 14 in monitor and i change place the sameint sensorValue = A0;
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
pinMode(sensorValue, INPUT);
}
void loop() {
// read the input on analog pin 0:
digitalWrite(sensorValue, LOW);
Serial.println(sensorValue);
delay(1000);
}
Sure it shows 14 because Analog pin A0 is actually Pin 14...
Take a look at this example(which I've already posted earlier but i guess you didn't look at it)..
sure no so help me
mnayra:
sure no so help me
Delta_G and i, both explained to you why you see number 14 on your serial monitor.. So i guess its obvious so far..
There is an example on my previous post, you can check on it..
mnayra:
sure no so help me
What's wrong with the code in reply #7? That illustrates most all the things you need to understand to make this work. As you haven't really said what you want this code to do, the best you are going to get is generic examples like that. What part of it are you not understanding?
Delta_G:
I just caught the comment there. Do you really think they would have named the function that READS a pin with a name including the word WRITE?
i have sayed no
mnayra:
i have sayed no
I hear ya. Did you read the rest of the post before that one? It told what to use instead?
Have you looked at the code in reply #7? It shows too.
What part are you not getting?
the correct code ?,
mnayra:
the correct code ?,
You've yet to say what this code should do.
I ask again, what is wrong with the code in reply 7? You should be able to go from there. Nobody is going to just write it for you. Especially when you haven't been clear what you require from the code.
No more one line replies from you. If you aren't willing to talk, then I will soon be tired of trying to help you.
Hi,
If you look at the pictures supplied, ALL the sensors have a trim pot and a Dout pin.
I would say that they are not analog output but digital, that goes HIGH when the measured quantity is higher than the pot set value.
Can the OP please post a link or tell us where her purchased them and their part number.
I don't think you are going to get an analog proportional output from them.
Tom......
Thread locked. Stop cross-posting.