This file contains hidden or 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
| from machine import I2C | |
| import time | |
| # BME280 default address. | |
| BME280_I2CADDR = 0x76 | |
| # Operating Modes | |
| BME280_OSAMPLE_1 = 1 | |
| BME280_OSAMPLE_2 = 2 | |
| BME280_OSAMPLE_4 = 3 |
This file contains hidden or 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
| import paho.mqtt.client as mqtt | |
| # The callback for when the client receives a CONNACK response from the server. | |
| def on_connect(client, userdata, flags, rc): | |
| print("Connected with result code "+str(rc)) | |
| # Subscribing in on_connect() means that if we lose the connection and | |
| # reconnect then subscriptions will be renewed. | |
| client.subscribe("techexplorations/test") |
This file contains hidden or 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
| byte encodebool(boolean* arr) | |
| { | |
| byte val = 0; | |
| for (int i = 0; i<4; i++) | |
| { | |
| val <<= 1; | |
| if (arr[i]) val |= 1; | |
| } | |
| return val; | |
| } |
This file contains hidden or 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
| // Written by Peter Dalmaris from Tech Explorations. | |
| // Used to find out how long an ESP32 can last on a LiPo battery. | |
| // This sketch will blink the LED at GPIO5 once per second and | |
| // store the number of blinks in an EEPROM location. | |
| // In between blinks, the ESP32 goes to sleep. | |
| #include "EEPROM.h" | |
| #include <DeepSleepScheduler.h> | |
| #ifdef ESP32 |
This file contains hidden or 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
| // Written by Peter Dalmaris from Tech Explorations. | |
| // Used to find out how long an ESP32 can last on a LiPo battery. | |
| // This sketch will simply blink an LED at a 1Hz frequency. | |
| // It will increment the counter in EEPROM address 0 every time it blinks. | |
| // https://techexplorations.com | |
| #include "EEPROM.h" | |
| int addr = 0; | |
| #define EEPROM_SIZE 32 |
This file contains hidden or 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 sketch will initialise the long | |
| // counter in address 0. | |
| // Written by Peter Dalmaris from Tech Explorations. | |
| // Used to find out how long an ESP32 can last on a LiPo battery. | |
| // https://techexplorations.com | |
| #include "EEPROM.h" | |
| int addr = 0; | |
| #define EEPROM_SIZE 32 |
This file contains hidden or 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 sketch will read the long in EEPROM address 0. | |
| // Written by Peter Dalmaris from Tech Explorations. | |
| // Used to find out how long an ESP32 can last on a LiPo battery. | |
| // https://techexplorations.com | |
| #include "EEPROM.h" | |
| int addr = 0; | |
| #define EEPROM_SIZE 32 |
This file contains hidden or 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
| # Start the rf24 listener script as a service at startup | |
| # Copy this file into /etc/systemd/system as root, for example: | |
| # sudo cp myscript.service /etc/systemd/system/rf24_receiver.service | |
| # Once this has been copied, you can attempt to start the service using the following command: | |
| # sudo systemctl start rf24_receiver.service | |
| # Stop it using following command: | |
| # sudo systemctl stop rf24_receiver.service | |
| # When you are happy that this starts and stops your app, you can have it start automatically on reboot by using this command: | |
| # sudo systemctl enable rf24_receiver.service | |
| # |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # The Twilio code in this script was written by Billy Hare as an extension of the Raspberry Pi Full Stack project. | |
| # With this extension, your Raspberry Pu Full Stack application will be capable | |
| # of sending and receiving text messages via the Twilio service. | |
| # More information: https://techexplorations.com/so/rpifs/ | |
| # | |
| # Simplest possible example of using RF24Network, | |
| # | |
| # RECEIVER NODE | |
| # Listens for messages from the transmitter and prints them out. |
This file contains hidden or 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
| #!/usr/bin/env python | |
| ''' | |
| FILE NAME | |
| env_log.py | |
| # The Twilio code in this script was written by Billy Hare as an extension of the Raspberry Pi Full Stack project. | |
| # With this extension, your Raspberry Pu Full Stack application will be capable | |
| # of sending and receiving text messages via the Twilio service. |