Skip to content

Commit

Permalink
Update simhat examples #161
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Oct 17, 2024
1 parent 6c7f6a6 commit e06400b
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 17 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@
| HttpsOTAUpgrade |||||||
| HP303BSensor* |||||||
| SPIExample* |||||||
| PowerMonitoring ||| ||| |
| SimHatAccelerometer ||| |[1] || |
| SimHatCurrentSensor ||| ||| |
| SimHatOneWireSensor ||| ||| |
| SimHatRelay ||| ||| |
| PowerMonitoring |||(No support)[2] ||| |
| SimHatAccelerometer |||(No support)[2] |[1] || |
| SimHatCurrentSensor |||(No support)[2] ||| |
| SimHatOneWireSensor |||(No support)[2] ||| |
| SimHatRelay |||(No support)[2] ||| |

- HP303BSensor,SPIExample it only demonstrates how to define and use SPI and I2C. Please confirm the pin connection and IO definition before use.
- [1] T-A7608-ESP32 Conflict with Solar ADC
- [2] The relay driver conflicts with the board RST and cannot work

# Quick start ⚡

Expand Down
15 changes: 10 additions & 5 deletions examples/SimHatAccelerometer/SimHatAccelerometer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@
#include <SensorQMI8658.hpp>

// T-A7670X SIM-Hat Pin
const uint8_t sda = 21;
const uint8_t scl = 22;
// #define IMU_SDA 21
// #define IMU_SCL 22
// #define IMU_INT1 39
// #define IMU_INT2 34 ///T-A7608-ESP32 Conflict with Solar ADC

#define IMU_INT1 39
#define IMU_INT2 34 ///T-A7608-ESP32 Conflict with Solar ADC

///T-A7608-ESP32S3 SIM-Hat Pin
#define IMU_SDA 2
#define IMU_SCL 1
#define IMU_INT1 38
#define IMU_INT2 46

SensorQMI8658 qmi;

Expand All @@ -29,7 +34,7 @@ void setup()
Serial.begin(115200);
while (!Serial);

if (!qmi.begin(Wire, QMI8658_L_SLAVE_ADDRESS, sda, scl)) {
if (!qmi.begin(Wire, QMI8658_L_SLAVE_ADDRESS, IMU_SDA, IMU_SCL)) {
Serial.println("Failed to find QMI8658 - check your wiring!");
while (1) {
delay(1000);
Expand Down
11 changes: 8 additions & 3 deletions examples/SimHatCurrentSensor/SimHatCurrentSensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ Adafruit_INA219 ina219_1(ina219_salve_address1);
Adafruit_INA219 ina219_2(ina219_salve_address2);

// T-A7670X SIM-Hat Pin
const uint8_t sda = 21;
const uint8_t scl = 22;
#define SENSOR_SDA 21
#define SENSOR_SCL 22

///T-A7608-ESP32S3 SIM-Hat Pin
// #define SENSOR_SDA 2
// #define SENSOR_SCL 1


void setup(void)
{
Expand All @@ -25,7 +30,7 @@ void setup(void)
delay(1);
}

Wire.begin(sda, scl);
Wire.begin(SENSOR_SDA, SENSOR_SCL);

Serial.println("Hello!");

Expand Down
3 changes: 3 additions & 0 deletions examples/SimHatOneWireSensor/SimHatOneWireSensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
// T-A7670X SIM-Hat Pin
#define DHTPIN 23 // Digital pin connected to the DHT sensor

///T-A7608-ESP32S3 SIM-Hat Pin
// #define DHTPIN 42 // Digital pin connected to the DHT sensor

// Feather HUZZAH ESP8266 note: use pins 3, 4, 5, 12, 13 or 14 --
// Pin 15 can work but DHT must be disconnected during program upload.

Expand Down
6 changes: 6 additions & 0 deletions examples/SimHatRelay/SimHatRelay.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
#define RELAY2_PIN 19
#define RELAY3_PIN 32

///T-A7608-ESP32S3 SIM-Hat Pin
// #define RELAY1_PIN 40
// #define RELAY2_PIN 41
// #define RELAY3_PIN 5


void setup(void)
{
Serial.begin(115200);
Expand Down
8 changes: 4 additions & 4 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
; https://www.lilygo.cc/products/t-a7608e-h
; default_envs = T-A7608X

; default_envs = T-A7608X-S3
default_envs = T-A7608X-S3

; default_envs = T-A7608X-DC-S3

Expand Down Expand Up @@ -78,10 +78,10 @@
; src_dir = examples/SendLocationFromSMS
; src_dir = examples/SendLocationFromSMS_Use_TinyGPS
; src_dir = examples/PowerMonitoring
; src_dir = examples/OneWireSensor
; src_dir = examples/INA219Sensor
; src_dir = examples/SimHatOneWireSensor
src_dir = examples/SimHatCurrentSensor
; src_dir = examples/SimHatRelay
src_dir = examples/SimHatAccelerometer
; src_dir = examples/SimHatAccelerometer


[env]
Expand Down

0 comments on commit e06400b

Please sign in to comment.