![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Gripper and Color sensor basic functionality testing.
Dependencies: mbed
driver.cpp@0:b30091b30223, 2016-03-26 (annotated)
- Committer:
- z_g13
- Date:
- Sat Mar 26 23:30:29 2016 +0000
- Revision:
- 0:b30091b30223
3/26/2016 - ZG;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
z_g13 | 0:b30091b30223 | 1 | #include "mbed.h" |
z_g13 | 0:b30091b30223 | 2 | #include "gripper.h" |
z_g13 | 0:b30091b30223 | 3 | #include "ColorSensor.h" |
z_g13 | 0:b30091b30223 | 4 | |
z_g13 | 0:b30091b30223 | 5 | Serial vcom(USBTX, USBRX); |
z_g13 | 0:b30091b30223 | 6 | |
z_g13 | 0:b30091b30223 | 7 | float frequency = 50.0f; |
z_g13 | 0:b30091b30223 | 8 | float duty_cycle = 0.50f; |
z_g13 | 0:b30091b30223 | 9 | float period = ( 1.0f / frequency ); |
z_g13 | 0:b30091b30223 | 10 | |
z_g13 | 0:b30091b30223 | 11 | int main() |
z_g13 | 0:b30091b30223 | 12 | { |
z_g13 | 0:b30091b30223 | 13 | vcom.baud(115200); |
z_g13 | 0:b30091b30223 | 14 | |
z_g13 | 0:b30091b30223 | 15 | vcom.printf("Hello World!"); |
z_g13 | 0:b30091b30223 | 16 | |
z_g13 | 0:b30091b30223 | 17 | Gripper gripper(PTB0, PTB1); |
z_g13 | 0:b30091b30223 | 18 | ColorSensor colorSensor(PTC2, PTC1); |
z_g13 | 0:b30091b30223 | 19 | |
z_g13 | 0:b30091b30223 | 20 | /* |
z_g13 | 0:b30091b30223 | 21 | gripper.grip(); |
z_g13 | 0:b30091b30223 | 22 | wait(1.0); |
z_g13 | 0:b30091b30223 | 23 | gripper.lift(); |
z_g13 | 0:b30091b30223 | 24 | wait(1.0); |
z_g13 | 0:b30091b30223 | 25 | gripper.lower(); |
z_g13 | 0:b30091b30223 | 26 | wait(1.0); |
z_g13 | 0:b30091b30223 | 27 | gripper.release(); |
z_g13 | 0:b30091b30223 | 28 | wait(1.0); |
z_g13 | 0:b30091b30223 | 29 | */ |
z_g13 | 0:b30091b30223 | 30 | |
z_g13 | 0:b30091b30223 | 31 | |
z_g13 | 0:b30091b30223 | 32 | |
z_g13 | 0:b30091b30223 | 33 | colorSensor.getR(); |
z_g13 | 0:b30091b30223 | 34 | vcom.printf("%i", colorSensor.getR()); |
z_g13 | 0:b30091b30223 | 35 | wait(0.5); |
z_g13 | 0:b30091b30223 | 36 | |
z_g13 | 0:b30091b30223 | 37 | } |