- 追加された行はこのように表示されます。
- 削除された行は
このように表示されます。
!!
! 割り込み処理
デジタルの2番ピン(割り込み番号0)と3番ピン(割り込み番号1)の状態の変化に応じて、割り込みを処理することができる
検出できる状態の変化には、以下の4通りがあります。
状態の変化 attachInterrupt()の第3引数
1 ピンがLOWのとき LOW
2 ピンの値が変わったとき CHANGE
3 ピンがLOWからHIGHに変わったとき RISING
4 ピンがHIGHからLOWに変わったとき FALLING
attachInterrupt()という関数を用いて、割り込み時に起動する関数を登録する。
登録できる関数は、戻り値も引数も持つことはできない
タイマー割り込みのサンプル::
http://nekosan0.bake-neko.net/library_timer.html
----
! print の 標準出力を COM へ
//***************************
static FILE uartout;
static int uart_putchar (char c, FILE *stream) {
if (Serial.write(c) > 0) {
return 0;
} else {
return -1;
}
}
//***************************
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
fdev_setup_stream (&uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE);
stdout = &uartout;
}
//***************************
----
!READ LINE Serial sample ( like fgets ????)
char buffer [32];
int cnt = 0;
boolean ready = false;
int funcval, alfa, beta, gumma;
void ParseLine
{
char key[8];
char value[8];
key = strtok(buffer, "="); // Everything up to the '=' is the color name
value = strtok(NULL, "\n"); // Everything else is the color value
if ((key != NULL) && (value != NULL))
{
funcval = atoi(value);
switch (toupper(key))
{
case 'A'
alfa = funcval;
break;
case 'B'
beta = funcval;
break;
case 'C'
gumma = funcval;
break;
}
}
}
void loop()
{
if (ready)
{
ParseLine();
ready = false;
} else while (Serial.available())
{
char c = Serial.read();
buffer[cnt++] = c;
if ((c == '\n') || (cnt == sizeof(buffer)-1))
{
buffer[cnt] = '\0';
cnt = 0;
ready = true;
}
}
}
----
!FlashMemory の使い方
https://www.arduino.cc/en/Reference/PROGMEM
http://garretlab.web.fc2.com/arduino_reference/language/values/utilities/progmem.html
----
! 赤外線モジュール
http://z3t0.github.io/Arduino-IRremote/
https://github.com/z3t0/Arduino-IRremote
https://github.com/bcdelta/ir_controller
----
! 日本語リファレンス
http://www.musashinodenpa.com/arduino/ref/
----
ネタ元
[逆引きArduino|http://garretlab.web.fc2.com/arduino/reverse_lookup/index.html]
[typedef|http://stackoverflow.com/questions/4295432/typedef-function-pointer]
http://edu.net.c.dendai.ac.jp/micom/2021/led/
----
http://s4a.cat/
----
!40Khz NE555
Ra=1.5K // Rb=17K // C=0.001uF(1000pF) == 40.67Khz
*http://www.zea.jp/audio/schematic/sc_file/018.htm
*https://akizukidenshi.com/catalog/g/gI-08344/
*https://akizukidenshi.com/catalog/g/gI-13263/
----
! モータ用コンデンサ
0.1uF (104) セラミックコンデンサー
----
! MIDI
https://github.com/FortySevenEffects/arduino_midi_library
https://github.com/FortySevenEffects/arduino_midi_library
----
! 音響合成
Mozzi
https://qiita.com/tueks3/items/8324a509ffd3d116f9cd
----
https://www.arnabkumardas.com/arduino-tutorial/gpio-programming/
----
! PS2 ゲームパッド
https://pspunch.com/pd/article/arduino_lib_gpsx.html
--
https://store.curiousinventor.com/guides/PS2
https://github.com/madsci1016/Arduino-PS2X
----