MPU6050 Tilt Angle Sensor icon MPU6050 Tilt Angle Sensor — Flash Arduino Uno firmware to read DHT11 temp/humidity and MPU6050 IMU simultaneously; provides $AngleX, $AngleY and $AngleZ variables. Try it →
Asked — Edited
Resolved Resolved by Dunning-Kruger!
1 Participant

How To Time Sendserial Command

Ok... So I have a quick scripting question... I have two motor controllers in my project, and one is used up with the Movement Panel and the other I use send serial commands to control. Issue is how to write script to control duration of movement of the second ? I know for my movement controls I can script something like Forward(XXXX,XXX) and that will do it... However, I dont know how to script the sendserial command to the same since I cant use the same method as it is not linked to the movement panel..


ARC Pro

Upgrade to ARC Pro

Subscribe to ARC Pro, and your robot will become a canvas for your imagination, limited only by your creativity.

#1  

The below will run the motor for 5 seconds then stop


sendSerial(D0,38400,127) #motor full speed
sleep(5000) #run motor for 5 seconds or for as long as you need
Sendserial(D0,38400,0) # stop the motor
#2  

Thx sir:) I was thinking about using the sleep command, but i thought it would just stop the whole thing all together after a fast twitch of the motor blush