Society of Robots - Robot Forum
Software => Software => Topic started by: Roboteccan 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
-
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).
-
If your question was 'is there example source code to use these specific sensors?', then the answer is also *yes*. :P
-
plese give me the link for the example source code for those censor.
-
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
-
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.
-
I suggest you use Project Designer with WebbotLib (its on my site http://webbot.org.uk (http://webbot.org.uk)) as it will make sure you connect the device properly and show some example code.
Looking at your code then:-
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'
-
it work, thanks for all friend ;D