Hi,
I need a little help ; I was sick so i just started today to try to use my ultrasonic sensor (SR04) with MRL but i didn't success because the function pulseIn isn't recognized by the arduino service and i don't know how to do without it . can someone help me .
Grog ,i just seen on this page http://myrobotlab.org/content/attacknid-hack-robot-mrl that you speak about make a map of the environement . I'm very interested ! with my six sensors around the base of my robot, i must have a very good map !
thx
here is what i did :
from time import sleep
from org.myrobotlab.service import Arduino # variables dependent on your setup boardType = "atmega328" # atmega168 | atmega328p | atmega2560 | atmega1280 | atmega32u4 comPort = "COM4" trigPin = 22 echoPin = 23 # create an Arduino service named arduino arduino = runtime.createAndStart("arduino","Arduino") # set the board type arduino.setBoard(boardType) # atmega168 | mega2560 | etc # set serial device arduino.connect(comPort) sleep(1) # give it a second for the serial device to get ready # pins setup arduino.pinMode(trigPin, arduino.OUTPUT); arduino.pinMode(echoPin, arduino.INPUT); # update the gui with configuration changes arduino.publishState() # calculate the distance arduino.digitalWrite(trigPin, arduino.LOW) sleep(0.002); arduino.digitalWrite(trigPin, arduino.HIGH) sleep(0.01); arduino.digitalWrite(trigPin, arduino.LOW) duration = arduino.pulseIn(echoPin, arduino.HIGH) ERROR ! #Convert the distance (in cm) based on the speed of sound. distance = duration/58.2
Beetlejuice ! Your back ! And
Beetlejuice !
Your back !
And I agree ! - We must build the Mapping !
I will implement pulseIn .. it will take a little time. In the inerim can you post pictures of your robot, or of the 6 sensors you currently have? Or do you have only 1 sensor? In order to provide maximum help I need to know your setup.
Currently, I'm still working on move from code.google.com to github.com :P taking much longer than I expected, but right after I would like to do this & PIR.
Here is some pictures still
Here is some pictures
still miss the hands, and i must redo the head with the same wood than the body .
Front
Back
Her is the code i'm testing