dumped all my old arduino stuff in here.
This commit is contained in:
parent
8cc6f23f59
commit
8f8959b76f
76 changed files with 8127 additions and 2 deletions
37
light.txt
Normal file
37
light.txt
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
1. #define TSL_FREQ_PIN 2 // output use digital pin2 for interrupt
|
||||
2. #define TSL_S0 5
|
||||
3. #define TSL_S1 6
|
||||
4. #define TSL_S2 7
|
||||
5. #define TSL_S3 8
|
||||
|
||||
1. unsigned long pulse_cnt = 0;
|
||||
2.
|
||||
3. void setup() {
|
||||
4.
|
||||
5. // attach interrupt to pin2, send output pin of TSL230R to arduino 2
|
||||
6. // call handler on each rising pulse
|
||||
7.
|
||||
8. attachInterrupt(0, add_pulse, RISING);
|
||||
9.
|
||||
10. pinMode(TSL_FREQ_PIN, INPUT);
|
||||
11. pinMode(TSL_S0, OUTPUT);
|
||||
12. pinMode(TSL_S1, OUTPUT);
|
||||
13. pinMode(TSL_S2, OUTPUT);
|
||||
14. pinMode(TSL_S3, OUTPUT);
|
||||
15.
|
||||
16. digitalWrite(TSL_S0, HIGH);
|
||||
17. digitalWrite(TSL_S1, LOW);
|
||||
18. digitalWrite(TSL_S2, HIGH);
|
||||
19. digitalWrite(TSL_S3, HIGH);
|
||||
20. }
|
||||
21.
|
||||
22. void loop() {
|
||||
23.
|
||||
24. }
|
||||
25.
|
||||
26. void add_pulse() {
|
||||
27.
|
||||
28. // increase pulse count
|
||||
29. pulse_cnt++;
|
||||
30. return;
|
||||
31. }
|
||||
Loading…
Add table
Add a link
Reference in a new issue