camera class
Diff: Camera.cpp
- Revision:
- 0:cae20a12e706
- Child:
- 1:25f7955d754f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Camera.cpp Mon Mar 13 09:39:52 2017 +0000 @@ -0,0 +1,34 @@ +#include "Camera.h" + + +Camera::Camera(PinName digOut, PinName clock, PinName AnIn ): OUT(digOut), CLK(clock) +{ + IN = new AnalogIn(AnIn); +} + +/* + Captures a line and fills an array with its values + */ +void Camera::capture() +{ + DigitalOut out(OUT); + DigitalOut clk(CLK); + + out = 1; //out high + clk = 1; //clock high + out = 0; //out low + clk = 0; //clock low + for(int i = 0; i < 128; i++) + { + clk = 1; + clk = 0; + } + + for(int i=0; i<128; i++) + { + clk = 1; + imageData[i] = IN->read()*100; //reads scales the values to be used as an integer percentage of whiteness + clk = 0; + } + return; +}