nightingale
/
LineCamLPC
reedit
Fork of LineCamLPC by
Revision 0:e8239da79e45, committed 2018-03-28
- Comitter:
- andrey001207
- Date:
- Wed Mar 28 12:48:00 2018 +0000
- Commit message:
- edit
Changed in this revision
diff -r 000000000000 -r e8239da79e45 TSL_1401.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TSL_1401.lib Wed Mar 28 12:48:00 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/nightingale/code/TSL_1401/#82f151c23f33
diff -r 000000000000 -r e8239da79e45 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Mar 28 12:48:00 2018 +0000 @@ -0,0 +1,84 @@ +#include "mbed.h" + +#define SI_pin p12 +#define CLK_pin p13 +#define AO_pin p15 + +#define HIGH 0x1 +#define LOW 0x0 + + +DigitalOut SI (SI_pin); +DigitalOut CLK (CLK_pin); +AnalogIn AO(p15); +AnalogIn AC(p18); + +float data[128]; +int line[128]; +Serial pc(USBTX, USBRX, 115200); + +void CamInit(); +void ScanFrame(); + +int main() { + pc.printf("Starting...\n"); + CamInit(); + // SI = HIGH; + // CLK = HIGH; + while(1) { + ScanFrame(); + /*for (int i = 0; i < 128; i+=2) + { + pc.printf("%i ", (int)(data[i] * 4096 / 100)); + } */ + for (int i = 0; i < 128; i++) + if (data[i] < AC) + pc.printf("O"); + else + pc.printf(" "); + // wait_ms(0); + pc.printf("\n"); + + } +} + +void CamInit() +{ + SI = HIGH; + CLK = HIGH; + wait_us(5); + SI = LOW; + CLK = LOW; + wait_us(5); + + for (int i = 0; i < 128; i++) + { + CLK = HIGH; + wait_us(5); + CLK = LOW; + wait_us(5); + } +} + +void ScanFrame() +{ + SI = HIGH; + CLK = HIGH; + wait_us(5); + SI = LOW; + CLK = LOW; + wait_us(5); + + for (int i = 0;i < 128; i++) + { + data[i] = AO; + CLK = HIGH; + wait_us(5); + CLK = LOW; + wait_us(5); + } +} + + + +
diff -r 000000000000 -r e8239da79e45 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 28 12:48:00 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/5571c4ff569f \ No newline at end of file