Show Posts
|
|
Pages: [1] 2 3 ... 427
|
|
3
|
Using Arduino / Programming Questions / Re: Use reset pin as I/O pin
|
on: May 22, 2013, 07:31:28 pm
|
The reset switch is connected to the reset pin, which we're talking about disabling. The ONLY way to make the reset pin back into acting like a reset pin is to use high voltage programming. You can't do the "arduino as ISP" trick -- that's low voltage ISP programming, not high voltage.
I didn't mean to unset the fuse, I meant to enable you to upload a sketch, which implies you need to reset the board. In the absence of a reset pin, you could force the reset by power cycling it, couldn't you?
|
|
|
|
|
4
|
Using Arduino / Programming Questions / Re: Using an IR sensor to track position of a servo
|
on: May 22, 2013, 07:29:52 pm
|
this is the code from the linked post which I have change to read the sonsor off the analog input
That code is looking for any change in the return value from analogRead(), which will naturally be fluctuating slightly just due to sampling noise, so it's hardly surprising that you are picking up spurious changes. Shouldn't you be looking for the signal going above/below a threshold, preferably with debounce and/or hysteresis? Depending on the levels, you might even be able to use a digital read.
|
|
|
|
|
7
|
Using Arduino / Programming Questions / Re: Use reset pin as I/O pin
|
on: May 22, 2013, 06:26:35 pm
|
You will probably need a High Voltage Parallel Programmer to program a chip with a disabled reset.
Never tried it, but I guess you could also force a 'big red switch' reset at the appropriate time during the upload sequence.
|
|
|
|
|
8
|
Using Arduino / Programming Questions / Re: Newbie: Interrutp/Volatile access to Servo
|
on: May 22, 2013, 06:23:15 pm
|
I want to add an interrupt that stops the servos when a drop-off is sensed.
If you mean that you want your robot to sense when it is reaching the edge of a surface, this is not a problem that calls for using interrupts. It is just a case of dealing with events from two (or more) sources. You can achieve that using the non-blocking approach demonstrated in the 'blink without delay' example, although that example doesn't make it at all obvious how important this non-blocking approach is. The approach would be to write some code that tests for input available on the serial port. If it's available, it reads it. If the message is complete and ready to be processed, it processes it. It does this without waiting - if there is no input, or the input message isn't complete, the code just carries on. Call this code from loop() so that it runs repeatedly. Add another piece of code that reads the state of your 'edge detection' sensor inputs and decides whether the 'bot needs to stop. If it does, stop the bot. Call this from loop() too, so that it runs repeatedly. Now that your loop() function is running repeatedly without stopping, you can also use it to do other things such as making LEDs blink, using the code demonstrated in 'blink without delay'. You can add as many independent features as you want, subject to the Arduino's limited memory and processing power, without any of them needing to know about each other.
|
|
|
|
|
9
|
Using Arduino / Project Guidance / Re: ROTARY ENCODER CODE...
|
on: May 22, 2013, 06:15:43 pm
|
i would like to measure the RPM of a vehicles tire (robot) on the surface....
Just out of curiosity, why do you want to measure that? I would have thought that measuring distance traveled would typically be more useful.
|
|
|
|
|
10
|
Using Arduino / Project Guidance / Re: speech recognition over LAN network
|
on: May 22, 2013, 06:13:33 pm
|
|
In that case it should be easy to implement. On the Arduino side you need to open a server socket and wait for incoming connections. Look for examples of Arduino based web servers to see what's involved in starting up the Ethernet interface using either DHCP or a static IP address, and opening a listening socket. You will need to decide which TCP port you are going to listen on. That might be specified by bitvoicer, or might be free for you to choose.
You sketch will accept the incoming connection requests and read bytes from the connected socket until the message is complete. I guess you already have logic in place to handle bytes received from a serial port and handling bytes received over a TCP connection would be essentially the same.
Once you have it working, you will need to figure out how the connection will be closed. Probably, bitvoicer will close the connection for you, and when the client closes the connection you need to close the associated socket - just as you'll see done in the web server examples.
|
|
|
|
|
11
|
Using Arduino / Project Guidance / Re: Controlling 8 CMOS switches
|
on: May 22, 2013, 06:02:08 pm
|
|
Given that you can read back the current state of an output pin, you don't strictly need to define a variable to remember it. You could simply do edge detection on the input switch to detect the button press (or release) and toggle the associated output pin.
|
|
|
|
|
12
|
Using Arduino / Programming Questions / Re: micros() wrapping problem
|
on: May 22, 2013, 08:46:37 am
|
I made a small demo to show that subtraction is not the only way though it is the better way. I thought I'd get lulz.
It looked complicated, but as far as I could see you were passing in 'now', 'start' and 'end' times as signed values and then explicitly looking for each case that could have occurred (rollover between start and now, and between start and end, and between now and end). As I see it, the point of the 'one true way' to compare time values by subtraction is that it avoids the need to handle the rollover situations explicitly. If you do handle rollover explicitly then you can code it using addition, subtraction or whatever method you want - just as long as you get it right.
|
|
|
|
|
14
|
Using Arduino / Programming Questions / Re: Confusing echo in serial window using sabertooth controller
|
on: May 22, 2013, 08:21:14 am
|
the OP hasn't said that as far as I see.
If you read the original post you would find the poster is reporting the spurious output on the serial monitor as a problem. So in this case, the use of the same serial pins for two connections is the direct cause of the problem. You seem to be quibbling about whether a given serial connection can be connected to more than two devices. Each Rx pin must be connected to no more than one Tx pin, or the two Tx devices will end up fighting with each other, which will typically not work and may even cause hardware damage. In this case Arduino pin 0 (Rx) was connected both to the USB serial device Tx pin and the sabertooth controller Tx pin. That's a bad idea. I agree it's possible to connect one sender to multiple receivers (as long as you don't also connect up the other half of the serial connection in the same way), but that is not what the OP has done here.
|
|
|
|
|
15
|
Using Arduino / Programming Questions / Re: magnetic encoder accumulation into new value
|
on: May 22, 2013, 08:01:31 am
|
i did try and write something but still need some pointers of how to actually get it to read and store those difference values..here is what I have so far but it just returns 0 for the difference.
Since you have only posted a code fragment we can't see how those variables are declared. The cumulative step counter and the variable holding the previous position, both need to be global or static variables. (The other variables can be temporary local variables if you like.)
|
|
|
|
|