Please help me to code this project
i want to make a simple water level indicator using jumper wire as sensors using button codes in example codes in arduino IDE.
thanks.
roy123:
i want to make a simple water level indicator using jumper wire as sensors using button codes in example codes in arduino IDE.
Firstly, I'm not being funny when I say I have literally no idea what that means.
Secondly.....
Please help me
..... in this forum is taken to mean that you go first. Try and do it yourself, then if you have problems, ask specific questions about specific parts that are hassling you. Usually you'll get loads of help.
Do you mean to use the conductivity of water and coated wires with bare ends at different levels with a ground wire at the bottom to determine water level within some margin?
You won't need button code. You will want to learn out pinmode( pinNumber, INPUT_PULLUP ) to keep pin-safe current levels and you will need to know about arrays and loops and then yes it's possible depending on the length of your wires, how many intervals you want to measure and whatever other practical concerns may apply, like not having other electric in the water.
There are other ways to check water depth depending on conditions, including echo, reflection and capacitance.
GoForSmoke:
Do you mean to use the conductivity of water and coated wires with bare ends at different levels with a ground wire at the bottom to determine water level within some margin?You won't need button code. You will want to learn out pinmode( pinNumber, INPUT_PULLUP ) to keep pin-safe current levels and you will need to know about arrays and loops and then yes it's possible depending on the length of your wires, how many intervals you want to measure and whatever other practical concerns may apply, like not having other electric in the water.
There are other ways to check water depth depending on conditions, including echo, reflection and capacitance.
Thanks for your reply
I want it to be like this project https://www.youtube.com/watch?v=iLDzF6u6Bu4 but with 3 jumper wire as sensor and 3 leds as output i couldn't get the right codes and i dont know the schematics?
is there any chance that i could make it using this?
Thank you
roy123:
I want it to be like this project https://www.youtube.com/watch?v=iLDzF6u6Bu4 but with 3 jumper wire as sensor and 3 leds as output i couldn't get the right codes and i dont know the schematics?
is there any chance that i could make it using this?
Thank you
Have you even tried?- it's not difficult to extrapolate that 1 pin / 1 led approach to 3.
Tell us where you got stuck?
JimboZA:
Have you even tried?- it's not difficult to extrapolate that 1 pin / 1 led approach to 3.
Tell us where you got stuck?
[/quote]
I am very sorry for me being dumbed
This is the code i come up with 2 pin / 2 led.
/*
Button
Turns on and off a light emitting diode(LED) connected to digital
pin 13, when pressing a pushbutton attached to pin 2.
The circuit:
-
LED attached from pin 13 to ground
-
pushbutton attached to pin 2 from +5V
-
10K resistor attached to pin 2 from ground
-
Note: on most Arduinos there is already an LED on the board
attached to pin 13.
created 2005
by DojoDave http://www.0j0.org
modified 30 Aug 2011
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Button
*/
// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 2;
const int buttonPin1 = 4;
const int ledPin = 12;// the number of the pushbutton pin
const int ledPin2 = 13;
// the number of the LED pin
// variables will change:
int buttonState = 0;
int buttonState2 = 0;// variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(ledPin2, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
pinMode(buttonPin1, INPUT);
}
void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
buttonState2 = digitalRead(buttonPin1);
if (buttonState2 == HIGH) {
// turn LED on:
digitalWrite(ledPin2, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin2, LOW);
}
}
now only the led2 for pin2 wire sensor is lighting when i sank the +5v pin and pin1 wire sensor on water.
Good day everyone!
I want to make a simple water level indicator like this project Arduino Water Detection Alarm Project - YouTube but with 3 input and 3 output.
My problem is I dont know how to program it with 3 input wire and 3 output leds.
I dont have any background on programming.
Thanks i hope you can help me with this project
I don't see anything obviously wrong. But it's a bit confusing to read when you have buttonPin1 matching ledPin2. So i'd suggest you go through it and get the numbering tidied up: rename all the original unnumbered variables to end in a "1" and the new ones to end in "2"; make sure they all match nicely.
Then to simplify things, I'd move away from the external resistors and use the internal pullups; makes the wiring sooooo much easier. It reverses the logic though, so you would change the if buttonstate==high to buttonstate==low and the low to high. See my pic attached for how to use the pullups and pulldowns. Your way uses pulldowns (and you look for a high); the internal resistors are pullups (so you look for a low). But you don't have to change it, it's just simpler.
Also we need a pic of your wiring. You can hand-draw and take a photo; attach in Additional Options....
One last thing.... pleeeeeease put your code in code tags, which is the # above the
smilies.
Then your
code
will look like
{
this
}
which is easier to read.
Why have you started a new thread? Having two threads going, in the same forum yet, is just bound to piss people off. I've alerted mods to this time wasting.
I am very sorry sir..
i will delete this thread now im sorry again ...
Thank you very much sir
I hope you can guide me until i finish this project.
And I am very sorry for making another thread ..
Big +1 on using the internal pullups!
Roy, the chip on an UNO has built-in resistors for each pin you can use so you don't have to wire your own.
You can read a pin with the pullup enabled and if it's not grounded it will be HIGH. If it's grounded it will be LOW. The pullup supplies the pin itself 5V at very low, easily drained, chip safe current. You can make a switch just by plugging a wire into a pin hole and grounding it. I've done it. I ground jumpers on that silver box the USB plugs into just because it's easier than pushing the end into a GND pin hole. Hey, I'm old and I need a magnifier to even find the damn hole!
There's down sides to hanging wires with bare ends in some places. The board becomes open to static and other power sources. If that water shorts an AC line then your Arduino may not alert you to anything. You might want to check your contacts (bare wire ends) for corrosion once in a while too, but that can be rubbed off.
Your IDE has example sketches to help you learn basics. Click File then Examples then choose a category to get at the examples. The Arduino site has a page for each with further explanation and pictures. If you go through sections 1, 2, 3 and 5 (please, skip 4 so you don't have to unlearn C++ Strings if you ever want to do much) and not even all the examples in 1, 2 and 3 then you will should have much less Fear than now and be able to approach projects knowing first level tools like arrays and loops as well as if and else. You will see how to read one thing and use the result of that to do another. You will be able to ask questions and get answers that will help you more.
Personally, I'd put a magnet on a float in the sump and have a cheap (50 cents) security sensor detect when it rises. That might require the float being in a piece of PVC pipe and occasional checks to see if anything is growing in it. Dirt won't affect that unless the float gets held down and the whole rig can be guarded against static and shorts. Also look into a piezo buzzer for a final stage alarm as those are harder to ignore than leds.
I am confused, is this thread dead ?
it appears to have been hijacked.......
dave-in-nj:
I am confused, is this thread dead ?it appears to have been hijacked.......
OP had two threads going and mods merged
Thanks a lot guys for your help and guidance
I finally made it
But I am thinking is it possible to implement GSM shield on this project??
If thats possible how to code it with with my existing code?
const int buttonPin = 2;
const int buttonPin1 = 4;
const int buttonPin2 = 6;
const int ledPin = 12;// the number of the pushbutton pin
const int ledPin1 = 13;
const int ledPin2 = 11;
// the number of the LED pin
// variables will change:
int buttonState = 0;
int buttonState2 = 0;// variable for reading the pushbutton status
int buttonState3 = 0;
void setup() {
 // initialize the LED pin as an output:
 pinMode(ledPin, OUTPUT);Â
 pinMode(ledPin1, OUTPUT);
 pinMode(ledPin2, OUTPUT);Â
 // initialize the pushbutton pin as an input:
 pinMode(buttonPin, INPUT);
 pinMode(buttonPin1, INPUT);
 pinMode(buttonPin2, INPUT);Â
}
void loop(){
 // read the state of the pushbutton value:
 buttonState = digitalRead(buttonPin);
 // check if the pushbutton is pressed.
 // if it is, the buttonState is HIGH:
 if (buttonState == HIGH) { Â
  // turn LED on: Â
  digitalWrite(ledPin, HIGH);Â
 }
 else {
  // turn LED off:
  digitalWrite(ledPin, LOW);
 }
 buttonState2 = digitalRead(buttonPin1);
 if (buttonState2 == HIGH) { Â
  // turn LED on: Â
  digitalWrite(ledPin1, HIGH);Â
 }
 else {
  // turn LED off:
Â
  digitalWrite(ledPin1, LOW);
 }
 buttonState3 = digitalRead(buttonPin2);
 if (buttonState3 == HIGH) { Â
  // turn LED on: Â
  digitalWrite(ledPin2, HIGH);Â
 }
 else {
  // turn LED off:
Â
  digitalWrite(ledPin2, LOW);
 }
Â
}