-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
310a5ff
commit 4a9c5b4
Showing
11 changed files
with
173 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
libraries/TSL260R/examples/TSL260R_internal_ADC/TSL260R_internal_ADC.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
libraries/TSL260R/examples/TSL260R_internal_ADC_average/TSL260R_internal_ADC_average.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// FILE: TSL260R_internal_ADC_average.ino | ||
// AUTHOR: Rob Tillaart | ||
// PURPOSE: demo average internal ADC | ||
// DATE: 2022-11-28 | ||
// | ||
// always check datasheet | ||
// | ||
// PIN 1 - GND | ||
// PIN 2 - VDD - 5V | ||
// PIN 3 - SIGNAL | ||
|
||
|
||
#include "TSL260R.h" | ||
|
||
TSL260R TSL0(A0, 1023, 5.0); // Arduino UNO | ||
|
||
uint32_t lastMeasurement = 0; | ||
|
||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.println(); | ||
Serial.println(__FILE__); | ||
Serial.print("\nTSL260R_LIB_VERSION: "); | ||
Serial.println(TSL260R_LIB_VERSION); | ||
|
||
Serial.println("\t TSL260\tTSL261\tTSL262"); | ||
Serial.println("uW/cm2"); | ||
Serial.println("========"); | ||
} | ||
|
||
|
||
void loop() | ||
{ | ||
uint32_t now = millis(); | ||
if (now - lastMeasurement >= 100) | ||
{ | ||
lastMeasurement = now; | ||
Serial.print(TSL0.irradiance(), 3); | ||
Serial.print("\t"); | ||
|
||
float voltage = 0; | ||
for (int i = 0; i < 10; i++) | ||
{ | ||
voltage += analogRead(A0) * (5.0 / 1023); | ||
} | ||
Serial.println(TSL0.irradiance(voltage * 0.1), 3); | ||
} | ||
} | ||
|
||
|
||
// -- END OF FILE -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.