Skip to content

Instantly share code, notes, and snippets.

@RyokoNa
RyokoNa / oled.py
Created December 2, 2024 01:58
OLED code using Raspberry Pi
import Adafruit_SSD1306
from PIL import Image, ImageDraw, ImageFont
import os
# Initialize the OLED display
disp = Adafruit_SSD1306.SSD1306_128_64(rst=None) # Adjust resolution if necessary
disp.begin()
disp.clear()
disp.display()
@RyokoNa
RyokoNa / rpicam.py
Created December 2, 2024 01:40
RPI AI cam code
import cv2
import numpy as np
import tflite_runtime.interpreter as tflite
from picamera2 import Picamera2
# Load the TensorFlow Lite model
MODEL_PATH = "model.tflite" # Replace with your model path
LABELS_PATH = "labels.txt" # Replace with your labels file
def load_labels(labels_path):
@RyokoNa
RyokoNa / dht22.py
Created December 2, 2024 01:35
Code for DHT22 capstone
import Adafruit_DHT
import time
# Set sensor type and GPIO pin
DHT_SENSOR = Adafruit_DHT.DHT22
DHT_PIN = 4 # Replace with the GPIO pin connected to the DATA pin
try:
print("Press Ctrl+C to exit.")
while True:
@RyokoNa
RyokoNa / autonomous_sumo_test_input
Created October 9, 2024 03:06
This code is for calibration all sensor for 1KG Autonomous Sumo Robot using URC10
//declare all sensor pin
const int OPP_L = 13;
const int OPP_R = 3;
const int OPP_FL = 12;
const int OPP_FR = 10;
const int OPP_FC = 11;
const int EDGE_R = A0;
const int EDGE_L = A1;
const int button = A4;
@RyokoNa
RyokoNa / gist:f68804bb02f63a8e8509b9fac2834c44
Created October 9, 2024 01:45
This is code for 1KG Autonomous Sumo Robot using URC10
#include "CytronMotorDriver.h" //library for motor driver
#define L 13 //left opponent sensor
#define FL 12 //centre left opponent sensor
#define FC 11 //centre opponent sensor
#define FR 10 //centre right opponent sensor
#define R 3 //right opponent sensor
@RyokoNa
RyokoNa / gist:cab0b18cd0b5e02b3dcd500b144078cf
Last active August 6, 2024 00:24
Weather Monitoring system
#define BLYNK_TEMPLATE_ID "TMPL6kGCXF7mI"
#define BLYNK_TEMPLATE_NAME "Weather Monitoring System"
#define BLYNK_AUTH_TOKEN "RI2qfZ9ozSPqf0hBziP7yqMyD3R3na25"
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
char auth[] = "RI2qfZ9ozSPqf0hBziP7yqMyD3R3na25"; //Enter the Auth code which was send by Blink
//home automation
#define BLYNK_TEMPLATE_ID "TMPL6_z4SFJ7d"
#define BLYNK_TEMPLATE_NAME "Home Automation"
#define BLYNK_AUTH_TOKEN "rzuUuTusqFRtKiCnolfgekU3AS2LWmGz"
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
@RyokoNa
RyokoNa / gist:edab5279ac33d3725d38f86b31d25b02
Last active August 13, 2024 00:57
Smoke and Flames Alert System
//smoke detection
#define BLYNK_TEMPLATE_ID "TMPL6kGCXF7mI"
#define BLYNK_TEMPLATE_NAME "Smoke and Flame alert system"
#define BLYNK_AUTH_TOKEN "RI2qfZ9ozSPqf0hBziP7yqMyD3R3na25"
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
//Blynk MQ-2 Smoke Detector By Yuvanesan Vijayan
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
@RyokoNa
RyokoNa / gist:7418826842af5f3890609a70916aca36
Last active July 26, 2024 04:09
Light Control using Blynk
#define BLYNK_TEMPLATE_ID "TMPL6vKaJSjxW"
#define BLYNK_TEMPLATE_NAME "LED CONTROL"
#define BLYNK_AUTH_TOKEN "jJQPIde8-KrCF42IVkiTeOvHodDjPo02"
//Blynk LED On OFF
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
char auth[] = "jJQPIde8-KrCF42IVkiTeOvHodDjPo02"; //Enter the Auth code which was send by Blynk
//rain detection
#define BLYNK_TEMPLATE_ID "TMPL6kGCXF7mI"
#define BLYNK_TEMPLATE_NAME "Rain Monitoring System"
#define BLYNK_AUTH_TOKEN "RI2qfZ9ozSPqf0hBziP7yqMyD3R3na25"
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "RI2qfZ9ozSPqf0hBziP7yqMyD3R3na25"; //Enter the Auth code which was send by Blink
char ssid[] = "Cytron"; //Replace with your WIFI Name