Giter Site home page Giter Site logo

avrlib's Introduction

8MhzAVRlib

内蔵8Mhz仕様への変更手順

  1. Arudino as ISPの設定に従って、2つのatmega328Pを接続します。
    16Mhzのマイコン(マイコンA)と、内蔵8Mhz駆動予定のマイコン(マイコンB)と呼びます。
  2. マイコンAにArduinoISPを書き込みます
  3. 書込装置をArsuino as ISPに変更する
    ボードをArudinoPro or Pro miniに変更する
    プロセッサを8Mhz 328Pに変更する マイコンBにブートローダーを書き込む
  4. マイコンBにヒューズを書き込む(Low:0xE2 Hi:0xDA Ex:0xFD)
    avrdude -c avrisp -P /dev/cu.usbmodem22101 -b 19200 -p m328p -U lfuse:w:0xE2:m -U hfuse:w:0xdA:m -U efuse:w:0xFD:m
  5. テストとして、src/example01.cppをコンパイルして実行する(bps=57600)

setTimeout機能

Timerクラスを利用することで、1ms単位でsetTimeout機能を使うことができます。
setTimeout関数の仕様はJavascriptの同関数と似ています。 内部のタイマー0を使用します。

使用方法

Timer::setTimeout(実行したい関数ポインタ,待ち時間(ms))
実行できる関数は引数と返り値がvoidの関数です。

  1. #include "src/Timer.h"
  2. Timer::init()を実行する
  3. Timer::setTimeout(hoge,1000);//1000ms後にhogeを実行する
  4. sei();while(true){};//割り込みを許可してください。無限ループを実行することで、プログラムのを実行させつづけます。

avrlib's People

Contributors

kamelong avatar

Stargazers

up-tri avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.