Author Topic: is compatible SRF04 and SRF08 with the axon microcontroller?  (Read 2948 times)

0 Members and 1 Guest are viewing this topic.

Offline RoboteccanTopic starter

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
is compatible SRF04 and SRF08 with the axon microcontroller?
« on: October 27, 2010, 06:19:06 PM »
is compatible SRF04 and SRF08 with the axon microcontroller? I have those sensor and I want know if this sensors are  compatible with axon microcontroller

Offline Metal Slug 2

  • Supreme Robot
  • *****
  • Posts: 333
  • Helpful? 11
Re: is compatible SRF04 and SRF08 with the axon microcontroller?
« Reply #1 on: October 27, 2010, 06:35:02 PM »
Yes to both.

Any sensor can be compatible with just about any microcontroller so long as you know how to utilize it (i.e. know which, if any, communication protocols it uses (I2C, SPI, UART etc.), and/or whether it provides analog and/or digital feedback).

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: is compatible SRF04 and SRF08 with the axon microcontroller?
« Reply #2 on: October 28, 2010, 02:34:32 PM »
If your question was 'is there example source code to use these specific sensors?', then the answer is also *yes*. :P

Offline RoboteccanTopic starter

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
Re: is compatible SRF04 and SRF08 with the axon microcontroller?
« Reply #3 on: October 29, 2010, 10:37:35 AM »
plese give me the link for the example source code for those censor.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: is compatible SRF04 and SRF08 with the axon microcontroller?
« Reply #4 on: October 29, 2010, 12:08:13 PM »
See any or all of these:

1) Axon II source code zip file
2) WebbotLib manual
3) WebbotLib Project Designer

run a search and you can find them

Offline RoboteccanTopic starter

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
Re: is compatible SRF04 and SRF08 with the axon microcontroller?
« Reply #5 on: November 01, 2010, 08:37:15 PM »
hi, I am novise to program in AVR Studio 4 I watch a lot code of SRF04_Sonar.h, but I need to confirm if the sensor is working with a program that if the objective is more than 15cm turn off and if the objective is less than 15cm turn on the led.

#include "sys/axon.h"
#include "C:\WebbotLib\Sensors\Distance\Devantech\SRF04_Sonar.h"
#include "C:\WebbotLib\led.h"
//#include<avr/IO.h> for work the port C

//DDRC = 0xFF; I am try declare the port c is working

Devantech_SRF04 sensor = MAKE_Devantech_SRF04(ADC0D,ADC1D);

void appInitHardware(void){
     distanceInit(sensor);
}


TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
    return 0;
}



TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){
distanceRead(sensor);
while (1)
{
double cm = sensor.distance.cm;
if(cm<15)
   {
    //PORTC = 1; I am try the port C1 turn on the led
   }
}
}

please help me.
« Last Edit: November 01, 2010, 10:44:50 PM by Roboteccan »

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: is compatible SRF04 and SRF08 with the axon microcontroller?
« Reply #6 on: November 01, 2010, 10:34:47 PM »
I suggest you use Project Designer with WebbotLib (its on my site http://webbot.org.uk) as it will make sure you connect the device properly and show some example code.
Looking at your code then:-
Code: [Select]
Devantech_SRF04 sensor = MAKE_Devantech_SRF04(ADC0D,ADC1D);..probably doesn't compile. What are pins ADC0D and ADC1D ??

In your appControl you need to get rid of the while(1)
appControl is called repeatedly anyway. And the while is messing up your code...you read the sensor once (and never again) and then the while loop is repeatedly doing something with that value

As for 'Trigger pulse' and 'echo pulse' then thats all happening for you inside the 'distanceRead'
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline RoboteccanTopic starter

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
Re: is compatible SRF04 and SRF08 with the axon microcontroller?
« Reply #7 on: November 02, 2010, 04:45:54 PM »
it work, thanks for all friend  ;D

 


Get Your Ad Here

data_list