LoginSignup
0
0

More than 1 year has passed since last update.

Arduino UNOで周波数を作てみた。(約1khzぐらい)(PWM利用)

Last updated at Posted at 2021-08-23

目的
基板作成が落ち着いたから
だいたい1khzを作った

h_con23.jpg

参考




#include <avr/io.h>

unsigned int frq = 1000; // 周波数

void setup() {

  pinMode(10, OUTPUT);

  // モード指定
  TCCR1A = 0b00100001;
  TCCR1B = 0b00010010;

  // TOP値指定
  OCR1A = (unsigned int)(1000000 / frq);

  // Duty比指定
  OCR1B = (unsigned int)(  (1000000 / frq)>>1  ) ;

}//setup

void loop() {
}//loop



0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0