Arduino cheat sheet: Difference between revisions

 
(17 intermediate revisions by the same user not shown)
AVR のニーモニックで HALT (Z80 や x86 でおなじみ) がみつからない。SLEEP てーのがそれかな?
[http://playground.arduino.cc/Learning/ArduinoSleepCode How to let your Arduino go to sleep and wake up on an external event.]
 
<syntaxhighlight lang="text" enclose="div">
SLEEP_MODE_IDLE
SLEEP_MODE_ADC
SLEEP_MODE_PWR_SAVE
SLEEP_MODE_EXT_STANDBY
SLEEP_MODE_STANDBY
SLEEP_MODE_PWR_DOWN
</syntaxhighlight>
 
==== sleep_mode() ====
もちろん、power_*_disable() もある。いったん power_all_disable() してから個別に設定も可。
 
==== DisablePower ADCSave いろいろ ====
これから試してみる...
<syntaxhighlight lang="c" enclose="div">
set_sleep_mode (SLEEP_MODE_PWR_DOWN);
sleep_mode();
ADCSRA = old_ADCSRA;
</syntaxhighlight>
 
<syntaxhighlight lang="c" enclose="div">
noInterrupts();
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_bod_disable();
interrupts();
sleep_cpu();
sleep_disable();
</syntaxhighlight>
 
avr/sleep.h のコメント読む...
<syntaxhighlight lang="c" enclose="div">
#include <avr/sleep.h>
 
...
...
set_sleep_mode(<mode>);
sleep_mode();
sleep_mode();
</syntaxhighlight>
<syntaxhighlight lang="c" enclose="div">
#include <avr/interrupt.h>
#include <avr/sleep.h>
 
...
...
set_sleep_mode(<mode>);
cli();
cli();
if (some_condition)
if (some_condition)
{
{
sleep_enable();
sleep_enable();
sei();
sei();
sleep_cpu();
sleep_cpu();
sleep_disable();
sleep_disable();
}
}
sei();
sei();
</syntaxhighlight>
<syntaxhighlight lang="c" enclose="div">
#include <avr/interrupt.h>
#include <avr/sleep.h>
 
...
...
set_sleep_mode(<mode>);
cli();
cli();
if (some_condition)
if (some_condition)
{
{
sleep_enable();
sleep_enable();
sleep_bod_disable();
sei();
sei();
sleep_cpu();
sleep_cpu();
sleep_disable();
sleep_disable();
}
}
sei();
sei();
</syntaxhighlight>
 
実測の結果:
<syntaxhighlight lang="c" enclose="div">
#include <avr/sleep.h>
#include <avr/power.h>
 
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
 
...
 
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
cbi(ADCSRA, ADEN);
power_all_disable();
//noInterrupts();
sleep_enable();
sleep_bod_disable();
//interrupts();
sleep_cpu();
sleep_disable();
power_all_enable();
sbi(ADCSRA, ADEN);
</syntaxhighlight>
 
=== AVR libc ===
[http://cega.jp/avr-libc-jp/ AVR Libc 日本語]
 
[http://www.akamoz.jp/you/junkbox/avr/avr-libc.htm AVR libcを使ってみる you/junkbox]
 
=== IoT するなら ===
[http://recruit.gmo.jp/engineer/jisedai/blog/%E3%80%90%E9%9B%BB%E5%AD%90%E5%B7%A5%E4%BD%9C%E3%80%91arduino-yun%E3%82%92google-docs%E3%82%84twitter%E3%81%A8%E9%80%A3%E6%90%BA%E3%81%97%E3%81%A6%E3%81%BF%E3%81%9F/ 【電子工作】Arduino YúnをGoogle DocsやTwitterと連携してみた | GMOインターネット 次世代システム研究室]
[http://blog.parse.com/learn/using-parse-for-iot-to-create-an-order-button/ Using Parse for IoT to Create an Order Button]
[http://qiita.com/ToshiakiEnami/items/7b4b3090f3687979d21a awsIoT - 太陽光パネルの発電量をAWS IoTとAmazon Elasticsearch Serviceを使って可視化してみる - Qiita]
 
[https://github.com/aws/aws-iot-device-sdk-arduino-yun/ SDK for connecting to AWS IoT from an Arduino Yún]
[http://ser2net.sourceforge.net/ Serial to Network Proxy (ser2net)]
 
[http://qiita.com/syoyo/items/d31e9db6851dfee3ef82 tunneling - Reverse ssh tunnel を安定運用する - Qiita]
[http://mm011106.github.io/blog/2015/02/23/init-dot-d-script/ init.dスクリプトを書いてみる - MQTT and …]
 
== Arduino の歴史 ==
[http://arduinohistory.github.io/ja.html Arduinoの語られざる歴史]
:こえーーー
 
[http://wiring.org.co/ Wiring]