Show Posts
|
|
Pages: 1 ... 3 4 [5] 6 7 ... 9
|
|
61
|
Using Arduino / Programming Questions / Re: Simple While Loop Problem
|
on: February 03, 2011, 01:04:49 am
|
|
yes that makes more sense. but is there a way to give the arduino input pin a valid low without explicitly tying it to ground? this pin will be switching on and off VERY quickly (probably less than 5ms) so it would be impossible to do it by hand
|
|
|
|
|
62
|
Using Arduino / Programming Questions / Re: Simple While Loop Problem
|
on: February 03, 2011, 12:46:19 am
|
If you don't want to use an external resistor you can learn how to enable the internal pull-up resistor for the input pin, and use a jumper wire from the pin to ground. Pull the wire you read a high, insert the wire and you read a low. Im sorry but i don't really understand this part. jumper pin 9 to ground, thats about all i got
|
|
|
|
|
64
|
Using Arduino / Programming Questions / Re: Simple While Loop Problem
|
on: February 03, 2011, 12:18:51 am
|
Yeah i noticed that i wasnt testing tripped inside the loop so i fixed that. now the problem i am having is that time is not actually updated and after the while loop it continues to be 0 as defined. Here is my new code: int speed1 = 9; int tripped; float time = 0; float Speed;
void setup() { pinMode(speed1, INPUT); Serial.begin(9600); Serial.println("Ready to Test Speed"); }
void loop() { tripped = digitalRead(speed1); if (tripped ==1) { while (tripped == 1) { delayMicroseconds(10); time + .000010; tripped = digitalRead(speed1); } Serial.println(time); time = 1000000*time; Serial.println(time); Speed = 5.0/time; Serial.println(Speed); } } i wish to increase the floating integer time by 10 micro seconds. so that for example, if pin 9 is high for 1 second, i would have a sampling rate of 10microseconds and so i could get a pretty accurate speed value. as for the hardware, i have pin 9 directly into 5v on the arduino uno
|
|
|
|
|
66
|
Using Arduino / Programming Questions / Simple While Loop Problem
|
on: February 02, 2011, 10:40:56 pm
|
Hi, I've never been any good with while loops but this one is not working and I can't figure out why. Basically, whenever pin 9 is read as HIGH the while loop begins, and begins incrementing time by 10 microseconds. Then when pin 9 is no longer HIGH (removed from 5v), the while loop ends and the a constant is then divided by the time, to give a rather accurate speed measurement. Here is my code, hopefully someone can help. Thanks everyone. int speed1 = 9; int tripped; float time = 0; float Speed;
void setup() { pinMode(speed1, INPUT); Serial.begin(9600); Serial.println("Ready to Test Speed"); }
void loop() { tripped = digitalRead(speed1); Serial.println(tripped); while (tripped !=0) { delayMicroseconds(10); time + .000010; Serial.println("Reading..."); } Serial.println(time); time = 1000000*time; Serial.println(time); Speed = 5.0/time; Serial.println(Speed); }
|
|
|
|
|
67
|
Using Arduino / Project Guidance / Re: Data from Internet to Arduino
|
on: January 28, 2011, 01:45:59 pm
|
|
cool, i will try the suggested methods out when i get home...also, instead of reading the received data into a string, what about reading it into a buffer so i can parse each individual byte and do switch case statements accordingly?
|
|
|
|
|
69
|
Using Arduino / Project Guidance / Data from Internet to Arduino
|
on: January 27, 2011, 09:38:48 pm
|
|
Hi, I am trying to think of some ways to get data from the internet (say a php page) to the arduino for parsing. The only current way I can think of is to setup a telnet server on the arduino with a public ip and then use php to send telnet commands to that arduino. but surely there must be some better way to send some data from the internet to the arduino. data from arduino to php is quite easy but it doesn't seem to be so easy going the other way. does anyone have any great ideas or experience towards this problem?
|
|
|
|
|
71
|
Using Arduino / Project Guidance / Re: Video and control over rf
|
on: January 27, 2011, 07:24:25 pm
|
thats kinda what i was suggesting, i know i've seen a lot of projects involving the arduino/ethernet shield/wirelessrouter...in fact right now im working on a circuit board that combines the ethernet shield and arduino main board all onto one board, so then all you need is the router 
|
|
|
|
|
72
|
Using Arduino / Project Guidance / Re: Email Timing Issue
|
on: January 27, 2011, 07:21:59 pm
|
|
not sure if this is connected, but i am kinda having the same problem. i have a telnet server set up on the arduino and when a specific command is sent to it, it sends a get command to the php site which the php site then uses to compare against a mysql page which then sends out an email to a specific address...anyhow the problem i'm having is that i run the command, email goes out, run it again and email goes out, third time and on, connection to the php server fails and nothing goes out. maybe this is your problem as well, maybe the connection is failing and then later going out again once the connection is re-established. just a thought
|
|
|
|
|
73
|
Using Arduino / Project Guidance / Re: Need guidance... :)
|
on: January 27, 2011, 12:35:10 pm
|
|
yeah im not sure what i was thinking at the time. i just mentioned ethernet as i have a nice little telnet server running on the arduino right now that can communicate over the internet rather well so i was suggesting along those lines. but i hadn't even thought of just using a pair of cat5 for the video (how simple). i knew ethernet was a complex protocol but i didn't think it was that bad. anyhow this isn't my project so i don't want to sideline it anymore, the subject matter of the project is interesting though
|
|
|
|
|
75
|
Using Arduino / Project Guidance / Re: Need guidance... :)
|
on: January 26, 2011, 11:41:42 pm
|
if it were my project i would try and do most of the commands/video via ethernet and ethernet protocols. especially since there already exists a very nice ethernet shield made by arduino. but maybe thats because i know more about ethernet protocols than serial....i could be way off base though 
|
|
|
|
|
Pages: 1 ... 3 4 [5] 6 7 ... 9
|
|