Skip to content

Instantly share code, notes, and snippets.

@uozias
uozias / user_fixture_from_csv.py
Created October 26, 2022 02:13 — forked from jalopez/user_fixture_from_csv.py
Django: Creates a JSON fixture for user model, from a CSV file
#!/usr/bin/python
import csv
import json
import hashlib
import random
import string
from optparse import OptionParser
def random_string(length):
char_set = string.ascii_letters + string.digits
@uozias
uozias / led.ino
Created February 22, 2016 02:47
LEDチカチカ for IOTやりてぃー#1
// 設定箇所
void setup() {
// digital pin 13をOUTPUTとして初期化
pinMode(13, OUTPUT);
}
// ループ箇所
void loop() {
digitalWrite(13, HIGH); // LEDをonにする (HIGHの電圧)
delay(1000); // 1秒待つ
require 'opencv'
require 'serialport'
window = OpenCV::GUI::Window.new "Camera"
capture = OpenCV::CvCapture.open
window2 = OpenCV::GUI::Window.new "LED"
width = 2880/10
int brightness = 0; // LEDの明るさを入れる
int fadeAmount = 5; // 明るさの変更スピードを設定
int received = 0; // 受け取った値(asciiコード)
int final_value = 0; // 変換後の数字
void reset_led(){
digitalWrite(2, LOW);
digitalWrite(3, LOW);
//set in Led’s digital IO pin control int Led1 = 1;
int Led2 = 2;
int Led3 = 3;
int Led4 = 4;
int Led5 = 5;
int Led6 = 6;
//led lamp run the example 1 program
void style_1(void)
{
unsigned char j;
@uozias
uozias / get_values_from_serialport
Created December 24, 2015 08:56
arduino gets values from serialport
int brightness = 0; // LEDの明るさを入れる
int fadeAmount = 5; // 明るさの変更スピードを設定
int received = 0; // 受け取った値(asciiコード)
int final_value = 0; // 変換後の数字
void setup() {
Serial.begin(9600); // シリアルポートを9600bpsで開く
pinMode(9, OUTPUT); //9番のピンを使う
}
@uozias
uozias / change_led_brightness
Created December 24, 2015 07:43
change led brightness with arduino
int brightness = 0; // LEDの明るさを入れる
int fadeAmount = 5; // 明るさの変更スピードを設定
void setup() {
Serial.begin(9600); // シリアルポートを9600bpsで開く
pinMode(9, OUTPUT); //9番のピンを使う
}
void loop() {
Serial.println(brightness);
analogWrite(9, brightness); //明るさを設定
brightness = brightness + fadeAmount; // 次の時点での明るさを計算
@uozias
uozias / morse_signal_practice.ino
Created December 11, 2015 11:55
Morse signal prctice app for Arduino with LED
int ledPin = 13; //13番をアウトプットに指定
int interval = 500; // ・1つは、0.5秒にする
int long_interval = interval * 3; // ーは・の3つ分まつ
String moji[] = {String("A"), String("B"), String("C"), String("D"), String("E"), String("F"), String("G"), String("H"), String("J"), String("K"), String("L"), String("M"), String("N"), String("O"), String("P"), String("Q"), String("R"), String("S"), String("T"), String("U"), String("V"), String("W"), String("X"), String("Y"), String("Z"), String("I")};
String tonTu[] = {String("sl"), String("lsss"), String("lsls"), String("lss"), String("s"), String("ssls"), String("lls"), String("ssss"), String("slll"), String("lsl"), String("slss"), String("ll"), String("ls"), String("lll"), String("slls"), String("llsl"), String("sls"), String("sss"), String("l"), String("ssl"), String("sssl"), String("sll"), String("lssl"), String("lsll"), String("llss"), String("ss")};
int lengthMojiArray = sizeof(moji) / sizeof(moji[0]);
@uozias
uozias / arduino_morse_signal2.ino
Created December 11, 2015 11:27
transfer keybord input to LED morse signal
int ledPin = 13; //13番をアウトプットに指定
int interval = 500; // ・1つは、0.5秒にする
int long_interval = interval * 3; // ーは・の3つ分まつ
String target = String("B"); // ここに表示したい文字1つを書く
String moji[] = {String("A"), String(""), String("B"), String("C"), String("D"), String("E"), String(""), String("F"), String("G"), String("H"), String(""), String("J"), String("K"), String("L"), String("M"), String("N"), String("O"), String(""), String("P"), String("Q"), String("R"), String("S"), String("T"), String("U"), String(""), String(""), String(""), String("V"), String("W"), String("X"), String("Y"), String("Z"), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String("")};
String tonTu[] = {String("sl"), String("slsl"), String("lsss"), String("lsls"), String("lss"), String("s"), String("sslss"), String("ssls"), String("lls"), String("ssss"), String("lsl
@uozias
uozias / arduino_morse_signal.ino
Created December 11, 2015 11:11
LED モールス信号 Arduino
int ledPin = 13; //13番をアウトプットに指定
int interval = 500; // ・1つは、0.5秒にする
int long_interval = interval * 3; // ーは・の3つ分まつ
String target = String("B"); // ここに表示したい文字1つを書く
String moji[] = {String("A"), String(""), String("B"), String("C"), String("D"), String("E"), String(""), String("F"), String("G"), String("H"), String(""), String("J"), String("K"), String("L"), String("M"), String("N"), String("O"), String(""), String("P"), String("Q"), String("R"), String("S"), String("T"), String("U"), String(""), String(""), String(""), String("V"), String("W"), String("X"), String("Y"), String("Z"), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String(""), String("")};
String tonTu[] = {String("sl"), String("slsl"), String("lsss"), String("lsls"), String("lss"), String("s"), String("sslss"), String("ssls"), String("lls"), String("ssss"), String("lsl