![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Robotic final work
Fork of Speed_control by
Revision 6:e3cc19965e74, committed 2016-07-23
- Comitter:
- roger5641
- Date:
- Sat Jul 23 13:48:41 2016 +0000
- Parent:
- 5:63c9ab496df9
- Commit message:
- Robotics final work
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Jun 06 10:07:52 2016 +0000 +++ b/main.cpp Sat Jul 23 13:48:41 2016 +0000 @@ -91,37 +91,11 @@ else servo_angle = 20; } - /*if(pc.readable()) - { - bluetooth.putc(pc.getc()); - } - if(bluetooth.readable()) - { - pc.putc(bluetooth.getc()); - }*/ } } void timer1_interrupt(void) -{ - - /*for(int i=0; i<8; i++) - { - Receive_Data[i] = bluetooth.getc(); - } - //read data from matlab - //distance_target - v1_ref = (Receive_Data[1]-0x30)*100 + (Receive_Data[2]-0x30)*10 + (Receive_Data[3]-0x30); - - if(Receive_Data[0] == '-')v1_ref = -1* v1_ref; - else v1_ref = v1_ref; - - //ang_rel_target - v2_ref = (Receive_Data[5]-0x30)*100 + (Receive_Data[6]-0x30)*10 + (Receive_Data[7]-0x30); - - if(Receive_Data[4] == '-')v2_ref = -1* v2_ref; - else v2_ref = v2_ref;*/ - +{ //Motor 1 v1 = (float)v1Count * 50.0f / 12.0f * 60.0f / 29.0f; //unit: rpm v1_avg = v1_avg + ( v1 - v1_old[9])/10.0f;