Arduino cheat sheet: Difference between revisions

 
(11 intermediate revisions by the same user not shown)
Line 396: Line 396:
AVR のニーモニックで HALT (Z80 や x86 でおなじみ) がみつからない。SLEEP てーのがそれかな?
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.]
  [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() ====
==== sleep_mode() ====
Line 443: Line 452:
avr/sleep.h のコメント読む...
avr/sleep.h のコメント読む...
<syntaxhighlight lang="c" enclose="div">
<syntaxhighlight lang="c" enclose="div">
     #include <avr/sleep.h>                                                                                                  
     #include <avr/sleep.h>
                                                                                                                             
 
     ...                                                                                                                      
     ...
       set_sleep_mode(<mode>);                                                                                                
       set_sleep_mode(<mode>);
       sleep_mode();                                                                                                          
       sleep_mode();
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang="c" enclose="div">
<syntaxhighlight lang="c" enclose="div">
     #include <avr/interrupt.h>                                                                                              
     #include <avr/interrupt.h>
     #include <avr/sleep.h>                                                                                                  
     #include <avr/sleep.h>
                                                                                                                             
 
     ...                                                                                                                      
     ...
       set_sleep_mode(<mode>);                                                                                                
       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>
<syntaxhighlight lang="c" enclose="div">
<syntaxhighlight lang="c" enclose="div">
     #include <avr/interrupt.h>                                                                                              
     #include <avr/interrupt.h>
     #include <avr/sleep.h>                                                                                                  
     #include <avr/sleep.h>
                                                                                                                             
 
     ...                                                                                                                      
     ...
       set_sleep_mode(<mode>);                                                                                                
       set_sleep_mode(<mode>);
       cli();                                                                                                                
       cli();
       if (some_condition)                                                                                                    
       if (some_condition)
       {                                                                                                                      
       {
         sleep_enable();                                                                                                      
         sleep_enable();
         sleep_bod_disable();                                                                                                
         sleep_bod_disable();
         sei();                                                                                                              
         sei();
         sleep_cpu();                                                                                                        
         sleep_cpu();
         sleep_disable();                                                                                                    
         sleep_disable();
       }                                                                                                                      
       }
       sei();                                                                                                                
       sei();
</syntaxhighlight>
</syntaxhighlight>


Line 486: Line 495:
<syntaxhighlight lang="c" enclose="div">
<syntaxhighlight lang="c" enclose="div">
#include <avr/sleep.h>
#include <avr/sleep.h>
#include <avr/power.h>


#ifndef cbi
#ifndef cbi
Line 496: Line 506:
  ...
  ...


   noInterrupts();
   set_sleep_mode(SLEEP_MODE_PWR_DOWN);
   cbi(ADCSRA, ADEN);
   cbi(ADCSRA, ADEN);
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
   power_all_disable();
   power_all_disable();
  //noInterrupts();
   sleep_enable();
   sleep_enable();
   sleep_bod_disable();
   sleep_bod_disable();
   interrupts();
   //interrupts();
   sleep_cpu();
   sleep_cpu();
   sleep_disable();
   sleep_disable();
Line 673: Line 683:
=== AVR libc ===
=== AVR libc ===
  [http://cega.jp/avr-libc-jp/ 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 するなら ===
=== IoT するなら ===
Line 680: Line 692:
  [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://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://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]
  [http://qiita.com/ToshiakiEnami/items/7b4b3090f3687979d21a awsIoT - 太陽光パネルの発電量をAWS IoTとAmazon Elasticsearch Serviceを使って可視化してみる]


  [https://github.com/aws/aws-iot-device-sdk-arduino-yun/ SDK for connecting to AWS IoT from an Arduino Yún]
  [https://github.com/aws/aws-iot-device-sdk-arduino-yun/ SDK for connecting to AWS IoT from an Arduino Yún]
Line 692: Line 704:
  [http://ser2net.sourceforge.net/ Serial to Network Proxy (ser2net)]
  [http://ser2net.sourceforge.net/ Serial to Network Proxy (ser2net)]


  [http://qiita.com/syoyo/items/d31e9db6851dfee3ef82 tunneling - Reverse ssh tunnel を安定運用する - Qiita]
  [http://qiita.com/syoyo/items/d31e9db6851dfee3ef82 tunneling - Reverse ssh tunnel を安定運用する]
  [http://mm011106.github.io/blog/2015/02/23/init-dot-d-script/ init.dスクリプトを書いてみる - MQTT and …]
  [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]