Skip to content

Instantly share code, notes, and snippets.

View kkmonster's full-sized avatar
🏠
Working from home

Wasin Wongkum kkmonster

🏠
Working from home
View GitHub Profile
@kkmonster
kkmonster / Install_OpenCV4_CUDA11_CUDNN8.md
Last active February 26, 2023 05:59 — forked from raulqf/Install_OpenCV4_CUDA12.6_CUDNN8.9.md
How to install OpenCV 4.5 with CUDA 11.2 in Ubuntu 20.04

How to install OpenCV 4.5.2 with CUDA 11.2 and CUDNN 8.2 in Ubuntu 20.04

First of all install update and upgrade your system:

    $ sudo apt update
    $ sudo apt upgrade

Then, install required libraries:

#include <Arduino.h>
#include <ESP32Encoder.h>
#define pulse2rev 824.5f
const int encoder_a = 26;
const int encoder_b = 25;
const int motor_control_a = 21;
const int motor_control_b = 22;
const int vr1_pin = 13, vr2_pin = 33, vr3_pin = 14, vr4_pin = 27;
import sensor
import image
import lcd
import time
import math
lcd.init(freq=20000000)
lcd.rotation(2)
sensor.reset()

This is a collection of code snippets for various features on the STM8S family microcontrollers (specifically the STM8S003F3). These are written against the STM8S/A SPL headers and compiled using SDCC.

Some of this controller's functions aren't particularly intuitive to program, so I'm dumping samples for future reference here. These are based on the STM8S documentation:

Run at 16MHz

# remove main.py boot.py - By: kkmon - Tue Nov 17 2020
import sensor, image, time
import os, sys, time
sys.path.append('')
sys.path.append('.')
os.chdir("/flash")
sys.path.append('/flash')
@kkmonster
kkmonster / twatch_k210_flower_prediction.py
Last active November 26, 2020 10:35
t watch : run classifier model
import sensor, image, lcd, time
import KPU as kpu
from fpioa_manager import *
from Maix import I2S, GPIO
from board import board_info
import audio
def play_wav(fname):
player = audio.Audio(path = fname)
player.volume(80)
@kkmonster
kkmonster / twatch_k210_flower_collection.py
Last active November 23, 2020 18:12
t watch : take a picture into folder
import sensor, image, time, lcd, os
import time, touchscreen as ts
from machine import I2C
import lcd, image
from board import board_info
from fpioa_manager import *
from Maix import FPIOA, GPIO
def create_folder():
os.chdir("/sd/datasets")
import sensor,image,lcd,time
import KPU as kpu
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_vflip(1)
sensor.run(1)
lcd.init(freq=20000000, color=lcd.BLACK)
import sensor, image, time, lcd
from Corgi85 import corgi85
token = "sqdSuyH9oidoRBZG5T72UdpYiMFcgeUEifAYTmSfdo8"
#reset esp8285
corgi85.reset()
#print(dir(corgi85))