Show Posts
Pages: 1 ... 97 98 [99] 100 101 ... 248
1471  Topics / Robotics / Re: Reading analog input using Arduino Motor Shield on: April 10, 2013, 11:47:11 am
No reason why not, unless your motor shield is using all your analog pins.

It sounds as though you are using delay though, so you're going to need millis to manage your motor instead so you can read the ADC. As ever, the blink without delay example sketch proviced with the IDE shows you how to use millis in this way.
1472  Using Arduino / Programming Questions / Re: Adding subroutines after setup() and loop() on: April 10, 2013, 09:18:22 am
This is going to be trouble:
Code:
int SW1 = digitalRead(SW1);

You're using the same name for the pin number as its result. Worse, you've masked the pin number by declaring this local version, so you're not reading the pin you expect.

Change the declaration to have a different name and don't forget to change it where you use it a few lines later.
1473  Using Arduino / Programming Questions / Re: Halo project compile errors on: April 10, 2013, 07:24:37 am
Look back at reply #9. The fact that you found additional errors after fixing it doesn't invalidate the fix.
1474  Using Arduino / Sensors / Re: DS18B20 device location on the 1-wire bus varies on: April 10, 2013, 07:06:25 am
getTempCByIndex gets the temperature from one of your sensors. Although it will be consistently the same one, there is no guarantee about which one that is. If you add or remove a sensor, the order may change. In particular, there is no correlation with the device's "Physical position on the bus" - electrically, they're all at the same place. A more reliable method is to use getTempC, which allows you to pass the device address.
1475  Using Arduino / Programming Questions / Re: Changing function state from inside a if-loop? I'm a little bit stuck here... on: April 09, 2013, 01:40:56 pm
Oh yes, LCDMode immediately puts it back. Try this there instead:
Code:
LCDMode = 1;

Not a pretty solution though.
1476  Using Arduino / Programming Questions / Re: Changing function state from inside a if-loop? I'm a little bit stuck here... on: April 09, 2013, 01:26:06 pm
Could it be as simple as setting mode to 1 after this?
Code:
    delay(40); //reset pulse
1477  Using Arduino / Project Guidance / Re: Newbie Needs help!!! on: April 09, 2013, 12:16:47 pm
How long does the vehicle take to stop, or what is the stopping distance? From 5mph, it may be stopping so quickly that you'll need multiple magnets on the wheel to establish the deceleration in tim to light the leds.

Edit: spelling
1478  Using Arduino / Project Guidance / Re: Combining code to make a new Program on: April 09, 2013, 09:48:52 am
It looks like a little tweaking would get it to compile at least. You appear to have pasted versions of setup and loop into the middle of your freeRam function - move them up above it. Then you'll have the issue of having two versions each of those two functions, so you'll need to combine them. Copy everything from the smaller versions into the larger and delete the original.

Both setups setup the serial port, only need one.

In the remaining loop, just run the decode function for now. Observe what it returns through the serial port when you press a particular button. Test for that & then add the code you have that plays a wave file.

I suspect that this last bit will be a struggle. You should be able to get a lot closer to a compilable program though. Post that version and any errors you get if you get stuck.
1479  Using Arduino / Programming Questions / Re: Reading the Arduino SD Card on: April 08, 2013, 06:21:26 pm
The only way you're going to get your file to the Pi is to read it and send it to the serial port - there's no built in facility on the Arduino to do it for you. You'll need some software on the receiving end too. However, I did notice this in the playground: http://playground.arduino.cc//Code/FTP

Disclaimer - I've never used it, nor did I give the code more than a brief perusal. Check it out; might give you some clues at least.
1480  Using Arduino / Programming Questions / Re: No serial output on: April 08, 2013, 06:15:02 pm
The issue is not the size of your source file, it's how much RAM your sketch is consuming at runtime. Judicious use of the F macro, as suggested above, should avoid the necessity to buy a Mega.
1481  Using Arduino / Programming Questions / Re: Reading the Arduino SD Card on: April 08, 2013, 10:39:16 am
Can you send "hello world" kind of things using Serial.print and receive them on the Pi?
1482  Using Arduino / Programming Questions / Re: Receiving weird results with 4 DS18B20 digital temp sensors??? (85 C, -127 C...) on: April 07, 2013, 10:39:47 pm
The resistance. The cable length adds it and so, if you're forced into long runs, a way to compensate is to reduce the size of the primary resistor.
1483  Using Arduino / Programming Questions / Re: Receiving weird results with 4 DS18B20 digital temp sensors??? (85 C, -127 C...) on: April 07, 2013, 04:35:40 pm
There's only supposed to be one pullup resistor, not one per DS18B20. Also, for longer runs, you may want to make it a bit smaller.
1484  Using Arduino / Project Guidance / Re: 3D Printer Advice on: April 07, 2013, 03:49:51 pm
There's no magic in RAMPS. You can certainly drive the device from an Arduino without it. RAMPS interfaces to a Mega, presumably to get more pins  but you could probably do it with an Uno too depending on how many pins your design requires.
1485  Using Arduino / Programming Questions / Re: char array to unsigned short array on: April 07, 2013, 11:02:00 am
You can use a pointer and point it to your existing array thus:
Code:
char image[10];
unsigned short *im = (unsigned short*)image;

And then operate using the pointer instead. You may have endian issues to overcome though.
Pages: 1 ... 97 98 [99] 100 101 ... 248