Skip to content

Instantly share code, notes, and snippets.

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_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
@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),
substitutions:
devicename: garage-cam
friendly_name: garagecam
ip_address: 192.168.1.53
esphome:
name: $devicename
platform: ESP32
board: esp-wrover-kit
#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"
@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"
}
@cyrus007
cyrus007 / FTC_bookmarks.md
Last active September 19, 2023 22:23
FTC bookmarks