Skip to content

Instantly share code, notes, and snippets.

View tatsuro-ueda's full-sized avatar

Tatsuro Ueda tatsuro-ueda

View GitHub Profile
#
# 別のボックスを使う
#
# config.vm.box = "base"
config.vm.box = "sinatra-enabled-ubuntu"
#
# 環境を使い分ける
#
if IS_VIA_PROXY == true then
@tatsuro-ueda
tatsuro-ueda / ToggleSwitch.cpp
Last active August 29, 2015 14:16
ArduinoでLEDを点灯させるトグルスイッチのコード
int lightIsOn = LOW;
int switchIsWaiting = HIGH;
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
if(digitalRead(12) == HIGH){ // スイッチが押されているなら
if(switchIsWaiting){
#encoding: utf-8
require 'miyako'
include Miyako
require "wincom"
require 'miyako_temp_lib'
# 初期化ここから
comp1 = Serial.new
comp1.open(5,0x0000,9600,8,0,0,256,256)
comp1.send("AT\r\n")
require 'net/smtp'
require 'tlsmail'
class Gmail
# 使う準備をする
def initialize(mail_address, mail_pass)
@mail_address = mail_address
@mail_pass = mail_pass
@smtpserver = Net::SMTP.new("smtp.gmail.com", 587)
@smtpserver.enable_tls(OpenSSL::SSL::VERIFY_NONE)
@tatsuro-ueda
tatsuro-ueda / _vimperatorrc
Created March 22, 2010 11:24
天気予報(降水確率付き)を取得する
command tenki :!D:\mydoc\lookup-weather-forecast.rb
@tatsuro-ueda
tatsuro-ueda / Button.pde
Created April 3, 2010 10:20
Arduinoをスピードセンサーにつなげてみた
// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 5; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
// 以下は【ステップ1】で使う
const int buttonPin = 5; // the number of the pushbutton pin
int buttonState = 0; // variable for reading the pushbutton status
int counter = 0; // 10ミリ秒ごとに1ずつ増えていくカウンタ
boolean has_touched = false; // 接触直後か(チャタリング対策)
// 以下はcalc_and_display()で使う
#include <LiquidCrystal.h>
LiquidCrystal clcd(6, 7, 8, 9, 10, 11); // Arduino-0017以降
#include <stdio.h> // sprintfを使うために必要
/*************************************************
* Public Constants
*************************************************/
#define NOTE_B0 31
#define NOTE_C1 33
#define NOTE_CS1 35
#define NOTE_D1 37
#define NOTE_DS1 39
#define NOTE_E1 41
// 以下は loop() で使う
const int buttonPin = 5; // the number of the pushbutton pin
boolean buttonState = 0; // variable for reading the pushbutton status
//int counter = 0; // 5ミリ秒ごとに1ずつ増えていくカウンタ
long cycle_time = 0; // 車輪が1周するのにかかった時間(ミリ秒)
long old_millis = 0; // 前回ボタンが押された時刻
boolean has_touched = false; // 接触直後か(チャタリング対策)
// 以下は calc_and_display() で使う
#include <LiquidCrystal.h>
// for setup()
int ledPinRed = 11;
int ledPinGreen = 10;
int ledPinBlue = 9;
// for getRandomColor()
int Color[3] = {0, 0, 0};
// for loop()
int valueRed = 0;