|
50
|
Using Arduino / Project Guidance / Re: IR proximity
|
on: May 17, 2013, 03:39:43 pm
|
|
IR Devices are digital. Is there a particular reason you are hooking them up to analog pins and using analogRead()?
How did you have them hooked up?
What code were you using?
We need much more than "I couldn't get it going"
|
|
|
|
|
51
|
Using Arduino / Project Guidance / Re: Door detection
|
on: May 17, 2013, 03:20:33 pm
|
Yes, but nothing in your requirements indicates that you need to communicate with a web interface. What's the main power consumption part of the project? Depends Can you tell me how much does each part (arduino, wifi shield, sensor) uses? Not until you choose an Arduino/WiFi shield and sensor to use. If your plan is to run it on batteries, then your best bet would be to get a very minimal Arduino (Just the chip and a few passive components), and have it sleep. When the sensor is tripped, the Arduino wakes, wakes up the communications medium (Be it WiFi/Celluar/Etc.), send the necessary notification and go back to sleep.
|
|
|
|
|
52
|
Using Arduino / Programming Questions / Re: Web server, How to make a simple button to reset a counter??
|
on: May 17, 2013, 01:12:40 pm
|
I am sorry but I don't think I understand the question.
This block of code returns a String: readString.substring(counter1,counter1+10) That String could be "DonkeysLovePhotography", "ThereWasNeverAGrassyKnoll", "counter1=T" or any other String. If it's the latter, then the if statement evaluates to true and counter is set to 0. Presumably, counter is not set to zero. So from that, we can conclude that the String returned from the aforementioned block of code is in fact, NOT equal to "counter1=T". So that begs the question what did that block of code return? This is where setting up Serial communication for debugging comes into play: void setup() { Serial.begin(115200); Serial.println("Begin"); ... }
void loop() { ... if (readString.substring(counter1,counter1+10) == "counter1=T") { counter = 0; } else { Serial.print("Substring returned = ["); Serial.print(readString.substring(counter1,counter1+10); Serial.println("]"); } } Knowing what the value returned is, or even if it gets to that part of the code, can clue us into what is causing your issue.
|
|
|
|
|
53
|
Using Arduino / Project Guidance / Re: Robot help please
|
on: May 17, 2013, 11:19:22 am
|
void setup() void loop() That does not look right, does it? Attempt to put the two loops together Is this a clever way of saying you haven't tried putting the loops together?
|
|
|
|
|
54
|
Using Arduino / Programming Questions / Re: Web server, How to make a simple button to reset a counter??
|
on: May 17, 2013, 11:17:10 am
|
That is correct. There is not other value, as I did not need it when I tested it the "test program" I wrote about.
All I want is a button to reset a variable called "counter" When the value stored in" counter" is greater than 0.
Thank you for your time!!
I asked a question that you didn't answer. I'll rephrase: What is the value being returned by this statement: readString.substring(counter1,counter1+10)
|
|
|
|
|
55
|
Using Arduino / Programming Questions / Re: toggle led
|
on: May 17, 2013, 11:02:58 am
|
How does this work if the ledPin is set as an output? You make the pin an output, to set the LED on/off and then(in that same line) your going to read the pin's state without changing its mode? How does that work.
You're not "making the pin an output" in this line of code. You're setting the bit in PORTX to either 1 or 0. Its a memory location (I think. It's memory mapped I/O, right?), so you can read it back. If this is true, then why bother needing pinMode, if digitalWrite sets the pin as an output and digitalRead makes it an input.
... They don't. digitalWrite sets the bit and digitalRead returns the bit. pinMode is what affects the DDRX port.
|
|
|
|
|
56
|
Using Arduino / Programming Questions / Re: Web server, How to make a simple button to reset a counter??
|
on: May 17, 2013, 10:57:43 am
|
Everything displays on the web server as it should, however when you click the reset button the variable “counter” does not get set to 0.
So the reset to 0 occurs in this part of the code: if (readString.substring(counter1,counter1+10) == "counter1=T") { counter = 0; } If what you're describing is true, then this if statement isn't returning true. So, what is the value of the substring when its not true?
|
|
|
|
|
57
|
Using Arduino / Programming Questions / Re: toggle led
|
on: May 17, 2013, 10:43:49 am
|
i need a sample program for led to toggle, if i press a push button led must on and if i again press the same push button led must get off and wise versa. pls tel me the logic
You need to detect the time at which the switch goes from HIGH to LOW or LOW to HIGH. This is known as the the signal edge. The StateChangeDetection example demonstrates this. From there, toggling the LEDs is simple: digitalWrite(ledPin, !digitalRead(ledPin));
|
|
|
|
|
58
|
Using Arduino / Project Guidance / Re: Home Automation
|
on: May 17, 2013, 10:38:28 am
|
The lack of indentation makes it look atrocious. In the Arduino IDE, press Ctrl+T to format the code before posting it.
but I couldn`t merge the two codes and make them work together The code does something. You want it to do something else. You've explained what you want it do, but you didn't explain what it actually does.
|
|
|
|
|