Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp@2:f3eafd4d3705, 2015-03-11 (annotated)
- Committer:
- ericoneill
- Date:
- Wed Mar 11 23:46:55 2015 +0000
- Revision:
- 2:f3eafd4d3705
- Parent:
- 1:c6fa316ce7d1
- Child:
- 3:4ba3d22e50dc
camera detecting
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ericoneill | 0:a7a8c6ef6d11 | 1 | #include "mbed.h" |
ericoneill | 0:a7a8c6ef6d11 | 2 | |
ericoneill | 0:a7a8c6ef6d11 | 3 | DigitalOut clk(PTA13); |
ericoneill | 1:c6fa316ce7d1 | 4 | DigitalOut si(PTD4); |
ericoneill | 0:a7a8c6ef6d11 | 5 | AnalogIn camData(PTC2); |
ericoneill | 0:a7a8c6ef6d11 | 6 | Timer t1; |
ericoneill | 0:a7a8c6ef6d11 | 7 | int main() { |
ericoneill | 0:a7a8c6ef6d11 | 8 | //clk.period_us(2); |
ericoneill | 0:a7a8c6ef6d11 | 9 | //clk.pulsewidth_us(1); |
ericoneill | 0:a7a8c6ef6d11 | 10 | t1.start(); |
ericoneill | 2:f3eafd4d3705 | 11 | //int integrationTime = 100 ;//SET THIS!! |
ericoneill | 1:c6fa316ce7d1 | 12 | int integrationCounter = 0; |
ericoneill | 0:a7a8c6ef6d11 | 13 | while(1) { |
ericoneill | 1:c6fa316ce7d1 | 14 | //int time = t1.read_us(); |
ericoneill | 2:f3eafd4d3705 | 15 | //(t1.read_us()>integrationTime){ |
ericoneill | 2:f3eafd4d3705 | 16 | if(integrationCounter % 120== 0){ |
ericoneill | 1:c6fa316ce7d1 | 17 | si = 1; |
ericoneill | 2:f3eafd4d3705 | 18 | clk = 1; |
ericoneill | 2:f3eafd4d3705 | 19 | //wait(.00001); |
ericoneill | 1:c6fa316ce7d1 | 20 | si = 0; |
ericoneill | 2:f3eafd4d3705 | 21 | clk = 0; |
ericoneill | 1:c6fa316ce7d1 | 22 | //integrationTime = time; |
ericoneill | 2:f3eafd4d3705 | 23 | t1.reset(); |
ericoneill | 2:f3eafd4d3705 | 24 | //integrationCounter = 0; |
ericoneill | 0:a7a8c6ef6d11 | 25 | } |
ericoneill | 2:f3eafd4d3705 | 26 | else{ |
ericoneill | 2:f3eafd4d3705 | 27 | clk = 1; |
ericoneill | 2:f3eafd4d3705 | 28 | clk = 0; |
ericoneill | 2:f3eafd4d3705 | 29 | } |
ericoneill | 2:f3eafd4d3705 | 30 | |
ericoneill | 2:f3eafd4d3705 | 31 | //clk = 0; |
ericoneill | 1:c6fa316ce7d1 | 32 | integrationCounter++; |
ericoneill | 1:c6fa316ce7d1 | 33 | //camData. |
ericoneill | 0:a7a8c6ef6d11 | 34 | |
ericoneill | 0:a7a8c6ef6d11 | 35 | } |
ericoneill | 0:a7a8c6ef6d11 | 36 | } |