Show Posts
Pages: 1 ... 19 20 [21] 22 23 ... 67
301  Using Arduino / Project Guidance / Re: VC++ - Arduino program stops midway while executing on: March 30, 2013, 07:37:55 pm
This may not be your bug, but I wonder if matters that if the first condition is true there is no "D" response sent to the PC.

Code:
    if((getDist() > 0) && (getDist() < 10))
    {
      stopRobot();
    }
    else
    {…
        Serial.print('D');
    }

-br
302  Using Arduino / Project Guidance / Re: VC++ - Arduino program stops midway while executing on: March 30, 2013, 07:01:26 pm
Does the Arduino function correctly for a longer time if you send characters to it manually from Serial Monitor or a terminal program instead of the C++ code?

-br
303  Using Arduino / Programming Questions / Re: Striping an error number out of a string. on: March 30, 2013, 05:52:27 pm
Love a little Saturday night code golf.  Here's an old-school approach:

Code:
int parseNum(char *buf, int pos) {
char *parseptr = buf + pos;
while (*parseptr && !isdigit(*parseptr)) ++parseptr;

int result = 0;
while (isdigit(*parseptr)) result = (result * 10) + *parseptr++ - '0';
return result;
}

-br
304  Using Arduino / General Electronics / Re: Identify this component on: March 30, 2013, 04:31:08 pm
Trimpots, maybe?

-br
305  Using Arduino / Programming Questions / Re: Adjusting for variable rollover? on: March 30, 2013, 03:51:51 pm
Next background interrupt thing I would eliminate is the Serial.print background output buffer handling.  Perhaps a delay(1000); at the start and end of loop to give the serial port time to quiesce before another cycle of readings starts.

-br

306  Using Arduino / Programming Questions / Re: Adjusting for variable rollover? on: March 30, 2013, 03:19:56 pm
I agree that free ram is a concern.  Search the forums for "free memory function" for the magic code that will report how much is free at startup.  Keep it above 200 or thy stack will invade thy heap.

I would also be wondering whether background interrupts like the millis() increment might be affecting the time interval between some samples.  An interrupt will displace all subsequent readings by a certain phase.  Perhaps it could create artifacts like we see in the chart of values.

You could test this second hypothesis by turning off interupts around the sampling loop, like this:

Code:
 cli();
  for (int i = 0; i < numReadings; i++) {
    inputReading [i]= analogRead(0);
  }
  sei();

Note that nothing is free; if you keep interrupts off long enough you will lose millis().  Doesn't seem critical in the program we see so far.

-br
307  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial communication with arduino from mac on: March 29, 2013, 08:28:42 pm
Glad it worked for you.

Good luck with your project.

-br
308  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial communication with arduino from mac on: March 29, 2013, 07:44:35 pm
It would be helpful to have some specific examples of commands that are failing.

See if it helps to use -d 2000 before you send anything to the arduino.  For the first two seconds after a reboot (which happens when you open the serial port) the arduino isn't listening because it's in the bootloader.

-br

309  Using Arduino / Installation & Troubleshooting / Re: MAC - Where the Tools / Serial Ports? on: March 29, 2013, 05:41:34 pm
From the .pdf:
Quote
// Connect your Arduino Uno to your Computer
Use the USB cable provided in the SIK kit to connect the Arduino to one of your computer’s USB inputs.
But you said:
Quote
Arduino Ethernet out to USB in
Which I will confess is confusing me.  Could you confirm you have a proper USB cable plugged into the Arduino and a USB port on your PC?  Do any lights turn on when you plug it in?

-br
310  Products / Arduino Due / Re: How do I use Arduino ide-1.5.x from github? on: March 28, 2013, 03:23:32 pm
Here's what works for me:

Code:
$ git clone git://github.com/arduino/Arduino.git
$ cd Arduino/build
$ ant clean; ant build; ant run

-br

311  Using Arduino / Programming Questions / Re: Processing and Arduino: seemingly no communication on: March 26, 2013, 09:51:47 am
May I suggest you try printing out val in serialEvent() to confirm whether it's ever being called?

-br
312  Using Arduino / Programming Questions / Re: Need help with basic code problem on: March 25, 2013, 08:11:43 pm
Well… you can use a while, but it will act a little strange (the state will increment extremely fast, so the effect will be to choose a random state.)

Couple issues with the code as presented, though:

1. As written that code won't compile because HIGH has to be uppercase.

2. If you don't digitalRead the button pin inside the loop, how is the value of buttonState ever going to change?


-br
313  Using Arduino / Programming Questions / Re: Arduino and Raspberry Pi through Serial on: March 25, 2013, 08:02:52 pm
Well try 115200 and see what you get then.  Maybe it will be a login screen. 

Anyway, it looks like all the initialization is for 115200.

Or go back and try working through the directions…

Cheers,

-br
314  Using Arduino / Programming Questions / Re: Arduino and Raspberry Pi through Serial on: March 25, 2013, 07:56:43 pm
Out of thoughts here except to try 115200 instead of 9600, if you haven't already.

You did go through the Disable Login and Disable Bootup Information procedures at that link, right?

-br
315  Using Arduino / Programming Questions / Re: Need help with basic code problem on: March 25, 2013, 07:52:41 pm
After you increment buttonCounter, you might want to check to see if it's greater than 7 and set it back to 0 so it goes through your cases again. 

You probably want code to handle the 0 case, too.

-br
Pages: 1 ... 19 20 [21] 22 23 ... 67