I need make an iOS APP to control my robot car
Speed+ and Speed- button control the system viable Speed value from 0 to 240. When APP first start, Speed value=0, when Speed+ pressed, Speed=Speed+10 (max 240). If Speed- pressed, Speed=Speed-10 , minimum speed is 0.
In above left picture, cell phone orientation angle is 45 degree, so APP should show the steering wheel rolling to left.
In middle picture, steering angel value=0 and steering wheel shows straight forward.
In right picture, angle=-45 degree, then steering wheel shows as rolling to right turn position.
When touch toggle the Transmission icon in APP, transmission gear Direction status will switch between above two status.
Variable Direction =1 when current transmission is Forward position, Direction value=0 when transmission is Backward position.
our UI image package download link:
above window will display all the incoming message from Bluetooth robot car.
Sending Bluetooth Message to Robot Car
When APP is just started, initial status will be Speed =0, Angle=0, Direction=1 (Forward direction)
Each Bluetooth message is in following format:
T means command type.
Default T command value is M which means moving forward,
The other T command values are :
L: Turning Left
R: Turning Right
B: Move Back
X: Move Back-Left
Y: Move Back-Right
F: F1 key pressed
G: F2 Key pressed
H:F3 Key pressed
I: F4 key Pressed
J: F5 key pressed
A means current gyro angle range value ,
When cell phone angle is from -15 to +15 degree, return range value 0(zero), when cell phone angle is 15 to 60 return range value 1, when cell phone is 60 to 90 return range value 2, when cell phone angle is -15 to -60 return range value -1, when cell phone angle is -60 to -90 return range value -2
S means current speed, value between 0 to 240 the value comes from Speed+ /Speed – button
D means current transmission direction. 1 means Forward , 0 means Reverse
For example , when the cell phone is in 10 degree angle(range 0), current speed meter shows 40, gear is set forward, bluetooth will send signal: M,0,40,1
When the cell phone is in -50 degree(range -1),gear is set Reverse, Speed now is 30, the car should go backward to left, bluetooth should send signal X,-1,30,0
When the cell phone is in 65 degree(range 2) , gear is forward, Speed is 180, the car should go right turn at speed of 180, bluetooth message should be R,2,180,1
If a F1 button is clicked, send message F,current angle,current speed,current gear
If a F2 button is clicked, send message G,current angle,current speed,current gear
If a F3 button is clicked, send message H,current angle,current speed,current gear
If a F4 button is clicked, send message I,current angle,current speed,current gear
If a F5 button is clicked, send message J,current angle,current speed,current gear
Button action Definition:
Speed+ : make Speed value +10 each press. no action if speed=240
Speed-: Make speed value -10 , no action if speed=0.
Engine Toggle button(UI shows Bluetooth, please change it to Engine) : When Engine is OFF status, ALL other buttons are disabled. When Enginess to toggled to ON, all buttons are enabled.
When Engine is toggled from ON to OFF, disable all buttons except Engine toggle. Also send Bluetooth message E,0,0,0 to robot.
When Should cell phone send bluetooth message?
When speed value=0, only send bluetooth message to robot car when Engine is ON and ( F buttons or speed button or gear button is pressed or Angle range values changed ). When Engine is OFF all bluetooth message should not be sent to robot.
When Speed+ button is pressed, speed value >0, then automatically every 50 ms send current status as (T,A,S,D) format to robot car. Gyro sensor should update angle value in real time.