This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// コンデンサマイクから拾った音の大きさが一定以上であれば,サーボを動かす | |
// 2012/08/21 できた!でも,一定以上の音が鳴っている間はサーボの角度を維持するようにしたいなあ | |
#include <Servo.h> | |
Servo myservo; // Servo型の変数 | |
int ecmPin = 0; // ECMは0ピンへ接続 | |
//int state = 0; // サーボの状態.1のときは130度まで回転した状態.0のときは30度まで回転した状態 | |
void setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
# 2012/10/25 作成 | |
# 複数の形容詞が記述されているファイルを読み込み, | |
# そのうちの一語をランダムに表示する | |
# adjectives.txtを読み込む | |
f = IO.readlines("adjectives.txt") | |
# readlines: 指定されたファイルを全て読み込んで,各行を要素として持つ配列を返す |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"/> | |
<title>いろいろカウントダウン</title> | |
</head> | |
<body> | |
<h1>残り日数を計算できます</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>タイマー</title> | |
</head> | |
<body> | |
<h1>タイマー</h1> | |
<p>カップラーメンの時間をはかったり,パスタの茹で時間をはかったりできる</p> | |
<div style="font-size:128px"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float FRICTION = 0.985; | |
public class Ripple{ | |
int x,y; | |
float dia; | |
float speed; | |
int colorH; | |
boolean flag; | |
Ripple() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cdsセルから読み取った値に応じて,ブザーの音程(発音)を制御するスケッチ | |
// ifで条件式を増やすことで,音程制御ができるようになる(はず) | |
// cdsセルから読み取った値が大きい→暗め | |
// cdsセルから読み取った値が小さい→明るめ | |
#include "pitches.h" | |
int val = 0; // アナログセンサから読み取った値用の変数 | |
int inputPin = 0; // 入力センサのピン番号 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cdsセルから読み取った値に応じて,LEDのONとOFFを制御するスケッチ | |
int val = 0; // アナログセンサから読み取った値用の変数 | |
int inputPin = 0; // 入力センサのピン番号 | |
int outputPin = 13; // 出力センサのピン番号 | |
void setup() { | |
Serial.begin(9600); // シリアルポートひらく | |
pinMode(outputPin, OUTPUT); // outputPinで設定したピン番号を出力モードにする | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 測距センサの値をシリアルモニタでチェックする | |
// 読み取ったセンサの値を視覚的にわかるようにシリアルモニタに表示する | |
// 対象との距離が近いほど数値が大きい.遠いほど数値が小さい. | |
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() { | |
int val; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 測距センサで読み取った値を音に変換 | |
// 8音(C4~C5)出せるようにする | |
#include "pitches.h" | |
int rangePin = 0; | |
int buzzPin = 13; | |
void setup() { | |
Serial.begin(9600); |
OlderNewer