Go Down

Topic: trouble with SRF-05 ultrasonic sensor and LCD issues (Read 543 times) previous topic - next topic

dinani42

Hello  every one.  I have an  awesome summo robot~(with IR and whiteline sensors) that  kicked  ass in the  last  summo competition i  participated in. I lost   2 a  guy with  6 motors and i  only had  four. Anyway  I'm not complaining.
Well  now i decided to add buttons an  LCD and  one  ultra sonic sensor.
well the   buttons  work  awesome   but  only  half of my  LCD works..  the  backlight  doesnt  even  come  on  and  it  displays only  half  the   screen. im  using the  exact set up  i got on the  arduino site  but  just   changed the  pins....  this is  what  my  code looks like...
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8,9,10,11,12,13);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop()
{
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}

BUT... my  biggest issue is  with the SRF-05.
i  have tested it  using a function generator and an  oscilloscope and it  works  fine... trouble  comes  connecting it  to the  arduino .
i know  i  need  two digital pins. one  for  the  trigger and one for the  echo   but  do  they  have  to be PWM?
pleaase  help  thannxxxx alot

MarkT

[ I won't respond to messages, use the forum please ]

AWOL

Quote
but  do  they  have  to be PWM?

No, neither does (one is an input anyway)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

dinani42

Thanks guys. I can now  read on  my  serial out. i  can read centimeters. but now when im  making  conditions, do i put in  centimeters

void loop()
{
if (distance = 100)
{
DriveForwad ();
}
else if (distance< 100)
{
Stop();
}

and my LCD is  faulty. it  has  nothing  to  do  with the wiring or my  code.  just tried someone else's LCD and it worked perfect..

AWOL

Code: [Select]
if (distance = 100)

BZZZZZZZZT!

Comparison, not assignment.

There is nothing in that sketch to read "distance" anyway.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up