Skip to content

Instantly share code, notes, and snippets.

@cyrus007
cyrus007 / FTC_bookmarks.md
Last active September 19, 2023 22:23
FTC bookmarks
@cyrus007
cyrus007 / esp32_AsyncMQTT.ino
Created January 20, 2020 18:40
Send sensor data using AsyncMQTT
/*********
Rui Santos
Complete project details at https://randomnerdtutorials.com
*********/
#include <WiFi.h>
extern "C" {
#include "freertos/FreeRTOS.h"
#include "freertos/timers.h"
}
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
#include <TaskScheduler.h>
#define SERVICE_UUID "9a8ca9ef-e43f-4157-9fee-c37a3d7dc12d"
#define BLINK_UUID "e94f85c8-7f57-4dbd-b8d3-2b56e107ed60"
#define SPEED_UUID "a8985fda-51aa-4f19-a777-71cf52abba1e"
substitutions:
devicename: garage-cam
friendly_name: garagecam
ip_address: 192.168.1.53
esphome:
name: $devicename
platform: ESP32
board: esp-wrover-kit
@cyrus007
cyrus007 / BLE_UART_SERVER.ino
Created January 9, 2020 21:53
ESP32 BLE server
/*
* "ESP32 BLE Server"
*
* Control RGB LED and two servos using the Android app "Bluetooth Remote".
* 1) create a BLE Device;
* 2) create a BLE Server;
* 3) create a BLE UART Service with one characteristic for TX
* and one for RX using the following UUIDs:
* 6E400001-B5A3-F393-E0A9-E50E24DCCA9E for the Service,
* 6E400002-B5A3-F393-E0A9-E50E24DCCA9E for the TX Characteristic (Property = Notify),
@cyrus007
cyrus007 / rpi_bt_speaker.py
Created October 3, 2019 18:30
Auto pair with BT speaker
#file autorun
#!/bin/bash
bluetoothctl << EOF
connect [enter your MAC add]
EOF
----------------------------------------------------------------------------
#file on.py
#!/usr/bin/python
#
# Monitor removal of bluetooth reciever
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN) #PIR
GPIO.setup(24, GPIO.OUT) #BUzzer
try:
time.sleep(2) # to stabilize sensor
@cyrus007
cyrus007 / rpi_octabrite_shiftbrite.py
Created October 3, 2019 03:59
Drive ShiftBrite LEDs using RPi
#!/usr/bin/env python
"""A simple/readable example of driving a Shiftbrite / Octobar / Allegro A6281
via hardware SPI on the Raspberry Pi.
You must have /dev/spidev* devices / bcm2708_spi driver for this to work.
"""
import fcntl, array, RPi.GPIO as GPIO
@cyrus007
cyrus007 / bme280_ota_esp12e.ino
Last active November 22, 2022 14:06
BME280 + OTA with esp8266 and Blynk
/* from https://community.blynk.cc/t/just-my-battery-operated-esp8266-enviro-sensor-node-with-ota-update/9375
V11 -> Temp
V9 -> Hum
V2 -> Pressure
V4 -> Lux
V8 -> Dew Point
V5 -> Temp Min
V6 -> Temp Max
V7 -> Reset Temp
V19 -> Vcc