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@1:c6fa316ce7d1, 2015-03-11 (annotated)
- Committer:
- ericoneill
- Date:
- Wed Mar 11 02:24:10 2015 +0000
- Revision:
- 1:c6fa316ce7d1
- Parent:
- 0:a7a8c6ef6d11
- Child:
- 2:f3eafd4d3705
latest; ;
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 | 1:c6fa316ce7d1 | 11 | int integrationTime = 100 ;//SET THIS!! | 
| ericoneill | 1:c6fa316ce7d1 | 12 | int integrationCounter = 0; | 
| ericoneill | 0:a7a8c6ef6d11 | 13 | while(1) { | 
| ericoneill | 0:a7a8c6ef6d11 | 14 | clk = 1; | 
| ericoneill | 1:c6fa316ce7d1 | 15 | //int time = t1.read_us(); | 
| ericoneill | 1:c6fa316ce7d1 | 16 | //if(t1.read_us()>integrationTime){ | 
| ericoneill | 1:c6fa316ce7d1 | 17 | if(integrationCounter > 150){ | 
| ericoneill | 1:c6fa316ce7d1 | 18 | si = 1; | 
| ericoneill | 1:c6fa316ce7d1 | 19 | wait(.00001); | 
| ericoneill | 1:c6fa316ce7d1 | 20 | si = 0; | 
| ericoneill | 1:c6fa316ce7d1 | 21 | //integrationTime = time; | 
| ericoneill | 1:c6fa316ce7d1 | 22 | //t1.reset(); | 
| ericoneill | 1:c6fa316ce7d1 | 23 | integrationCounter = 0; | 
| ericoneill | 0:a7a8c6ef6d11 | 24 | } | 
| ericoneill | 0:a7a8c6ef6d11 | 25 | clk = 0; | 
| ericoneill | 1:c6fa316ce7d1 | 26 | integrationCounter++; | 
| ericoneill | 1:c6fa316ce7d1 | 27 | //camData. | 
| ericoneill | 0:a7a8c6ef6d11 | 28 | |
| ericoneill | 0:a7a8c6ef6d11 | 29 | } | 
| ericoneill | 0:a7a8c6ef6d11 | 30 | } |