Hi again guys, so i have another question, i am trying to write a roam script for my bot but im a little confused about how i write a script to read a sonar, below is what i have so far
I2CStart() I2CWrite(0x42, 5) I2CStop() sleep(2000) I2CRestart() I2CWrite(0x42, 0x20, "Robot Roam Mode") I2CStop()
:Main forward() sleep(2000) if(digital(D10) < 15) goto(stop) goto(Main)
you can ignore the I2C stuff its just for the display, but with the echo port on D10 on my ping sonar basically if i run this script he starts moving and then stops, the sonar is reading 25 when he stops not 15 as in the script above, the main loop is what it says the main running loop the stop is well you guessed it stop, its just a test but like i said he starts of then stops, what am i doing wrong ?
Thanks KurtSkip to comments