-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
38b977e
commit 0e82832
Showing
2 changed files
with
111 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
platforms: | ||
rpipico: | ||
board: rp2040:rp2040:rpipico | ||
package: rp2040:rp2040 | ||
gcc: | ||
features: | ||
defines: | ||
- ARDUINO_ARCH_RP2040 | ||
warnings: | ||
flags: | ||
|
||
packages: | ||
rp2040:rp2040: | ||
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json | ||
|
||
compile: | ||
# Choosing to run compilation tests on 2 different Arduino platforms | ||
platforms: | ||
- uno | ||
# - due | ||
# - zero | ||
# - leonardo | ||
- m4 | ||
- esp32 | ||
- esp8266 | ||
# - mega2560 | ||
- rpipico | ||
libraries: | ||
- "AM232X" | ||
- "TCA9548" |
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,81 @@ | ||
// | ||
// FILE: TCA9548_demo_AM2320.ino | ||
// AUTHOR: Rob Tillaart | ||
// PURPOSE: demo TCA9548 I2C multiplexer | ||
// URL: https://github.com/RobTillaart/TCA9548 | ||
|
||
|
||
#include "AM232X.h" | ||
#include "TCA9548.h" | ||
|
||
PCA9546 MP(0x70); | ||
uint8_t channels = 0; | ||
|
||
AM232X living; // channel 0 | ||
AM232X kitchen; // channel 1 | ||
AM232X outside; // channel 2 | ||
|
||
uint32_t lastTime = 0; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.println(__FILE__); | ||
Serial.print("TCA9548_LIB_VERSION: "); | ||
Serial.println(TCA9548_LIB_VERSION); | ||
Serial.print("AM232X_LIB_VERSION: "); | ||
Serial.println(AM232X_LIB_VERSION); | ||
Serial.println(); | ||
|
||
Wire.begin(); | ||
// initialize multiplexer | ||
if (MP.begin() == false) | ||
{ | ||
Serial.println("Multiplexer error"); | ||
} | ||
channels = MP.channelCount(); | ||
|
||
// initialize the temperature sensors | ||
MP.selectChannel(0); | ||
if (living.begin() == false) | ||
{ | ||
Serial.println("living error"); | ||
} | ||
MP.selectChannel(1); | ||
if (kitchen.begin() == false ) | ||
{ | ||
Serial.println("kitchen error"); | ||
} | ||
MP.selectChannel(2); | ||
if (outside.begin() == false ) | ||
{ | ||
Serial.println("outside error"); | ||
} | ||
} | ||
|
||
|
||
void loop() | ||
{ | ||
if ((millis() - lastTime) > 5000) | ||
{ | ||
lastTime = millis(); | ||
|
||
MP.selectChannel(0); | ||
living.read(); | ||
Serial.print(living.getTemperature(), 1); | ||
Serial.print("\t"); | ||
|
||
MP.selectChannel(1); | ||
kitchen.read(); | ||
Serial.print(kitchen.getTemperature(), 1); | ||
Serial.print("\t"); | ||
|
||
MP.selectChannel(2); | ||
outside.read(); | ||
Serial.print(outside.getTemperature(), 1); | ||
Serial.print("\n"); | ||
} | ||
} | ||
|
||
|
||
// -- END OF FILE -- |