Show Posts
Pages: [1]
1  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: September 13, 2014, 12:02:36 pm
I am not sure why I'm not getting a return of zero for sensor readings that are out of range.  I get wildly varying distances when there is nothing in front of the sensors, but accurate readings when I have something in front.  Any ideas? I have two HC-SR04s on my bot, so I modified the NewPingExample for 2 sensors, but it does the same thing when only one sensor is being pinged.

Code:
#include <NewPing.h>

#define L_TRIG 46  // Arduino pin tied to trigger pin on the left ultrasonic sensor.
#define L_ECHO 47  // Arduino pin tied to echo pin on the left ultrasonic sensor.

#define R_TRIG 48  // Arduino pin tied to trigger pin on the right ultrasonic sensor.
#define R_ECHO 49  // Arduino pin tied to echo pin on the right ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar_L(L_TRIG, L_ECHO, MAX_DISTANCE); // NewPing setup of pins and maximum distance for left sensor.
NewPing sonar_R(R_TRIG, R_ECHO, MAX_DISTANCE); // NewPing setup of pins and maximum distance for right sensor.

unsigned int uS; //declare variable for ping time in microseconds

void setup() {
  Serial.begin(9600); // Open serial monitor at 9600 baud to see ping results.
}

void loop() {
  delay(50);                      // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
  uS = sonar_L.ping(); // Send ping, get ping time in microseconds (uS).
 
  Serial.print("L Ping: ");
  Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance in cm and print result (0 = outside set distance range)
 
   
  uS = sonar_R.ping(); // Send ping, get ping time in microseconds (uS).

  Serial.print("\tR Ping: ");
  Serial.println(uS / US_ROUNDTRIP_CM); // Convert ping time to distance in cm and print result (0 = outside set distance range)
 
}
2  Using Arduino / Motors, Mechanics, and Power / Re: UNO R3 and Motor Shield Tinkerkit Connectors on: August 14, 2014, 01:21:09 pm
hello

the tinkerkit connectors are not servo connectors, they have the signal at the centre pin.
The arduino store sells modified servos that have TK connectors.

it's also possible to re-position the pins in the connector.

m


So Massimo, are you saying the tinker connectors can be used for servos if the servo wires on the connector are rearranged so the signal is in the center?
3  Using Arduino / Installation & Troubleshooting / 3.3V Pro Mini not uploading sketches via SparkFun FTDI Basic Breakout on: April 15, 2014, 03:49:43 pm
I was able to upload and run programs to my Arduino Mega 2560 with no problems while prototyping, but when I connected my Pro Mini to my SparkFun FTDI breakout board and hooked it up to my computer, I would get this error when it attempted to upload my sketch:

avrdude: stk500_program_enable(): unknown response=0x41
avrdude: initilization failed, rc=-1
                Double check connections and try again, or use -F to override
                this check.
avrdude: stk500_disable():protocol error, expect=0x41, reap=056

I'm using windows 8 and did change my board selection.  I can see the TX and RX lights blinking when I first connect, and the green LED on the mini blinks about 8 times.  The red LED on the mini is on constantly.  Also, nothing is connected to the pro mini except the breakout board, and I did go through the troubleshooting steps on this website...

When I attempt to upload, the green on board LED blinks a few times and I see the TX and RX lights blinking as well. Then they all stop, except the red LED remains on.  

No idea what is going on.  Anyone out there know how to fix this?

Also on the bottom of the window I can see this displayed
Arduino Pro or Pro Mini (3.3v.8 MHz) w/ATmega328 on COM5

I tried two other mini USB cords and the third one allowed me to upload.  So problem solved.  I was not aware there were different types of mini usb cables??
4  Using Arduino / Audio / Re: EasyVR Shield - can't connect in UP Flash update mode on: December 26, 2012, 06:43:07 pm
I'm having similar issues.  Anyone ever respond?
5  Using Arduino / Installation & Troubleshooting / Re: Mega2560: timeout communicating with programmer.... on: December 05, 2012, 02:51:45 pm
I'm having the same problem.  No !!! in  my code and I was uploading fine, then it started giving me the same timeout error

avrdude: stk500v2_ReceiveMessage(): timeout

For a while, just unplugging the USB and plugging it back in would allow an upload, now it won't upload at all. And I did that, though it was a pain in the neck.

Grrrr.  Frustrating, I'm wondering if I made the wrong choice in getting this Arduino instead of another micro controller.
Pages: [1]