This code just added an algorithm to calculate angle form the pixy center
Dependents: pixyHelloWorld2_copy_servoTest pixy_pan_tilt Servo_camera_pan Camera_Gimbal_Tracking
Fork of pixy by
Revision 2:a58a6a71ae7b, committed 2015-07-01
- Comitter:
- LucasUIUC
- Date:
- Wed Jul 01 19:43:36 2015 +0000
- Parent:
- 1:f8b6497870d3
- Commit message:
- Code with servo position in pixy.h
Changed in this revision
Pixy.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r f8b6497870d3 -r a58a6a71ae7b Pixy.h --- a/Pixy.h Thu Jun 18 05:28:57 2015 +0000 +++ b/Pixy.h Wed Jul 01 19:43:36 2015 +0000 @@ -8,9 +8,13 @@ struct Block { void print(Serial &pc) { + float angle; angle = (float)(160 - x)*9/32; - pc.printf("sig: %d x: %d y: %d width: %d height: %d angle: %f\n", signature, x, y, width, height, angle); + float ServoPosition; + ServoPosition = (float)(angle + 45)*1/90; + + pc.printf("sig: %d x: %d y: %d width: %d height: %d angle: %f ServoP: %f\n", signature, x, y, width, height, angle, ServoPosition); }; uint16_t signature; uint16_t x; @@ -19,6 +23,7 @@ uint16_t height; }; + class Pixy { public: