I got a 4 - in - 1 sensor and have put together a 2 wheeled balancing robot. Now I need to figure out some coding. I have the Initialization script and it works good - getting lots of data. I'm not having any luck after that. Does anyone have some scripting they would be willing to share with me to help me get going?
Here's what I've got so far.
#Added these because $AccelX and $AccelY were not recognized later in the script for some reason.
$XAccel = $AccelX
$YAccel = $AccelY
if ("x" =0)
if($AccelX > 1000 and $AccelX < 1000)
print("x: " + $XAccel)
print("y: " + $YAccel)
if($AccelX > 1000)
elseif ($AccelX < 1000)
I am working with a code that d. cochran posted awhile ago.
It will change directions when it is tipped but will never stop. Also, after it has run for 30 seconds or so it will just keep running and the only way to stop the wheels is by disconnecting the power to the EZB.