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
Diff: Pixy.h
- Revision:
- 1:f8b6497870d3
- Parent:
- 0:ed8dc4531ac1
- Child:
- 2:a58a6a71ae7b
--- a/Pixy.h Sun Nov 16 11:52:55 2014 +0000 +++ b/Pixy.h Thu Jun 18 05:28:57 2015 +0000 @@ -8,7 +8,9 @@ struct Block { void print(Serial &pc) { - pc.printf("sig: %d x: %d y: %d width: %d height: %d\n", signature, x, y, width, height); + 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); }; uint16_t signature; uint16_t x;