0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

概要

micropythonでshrike-lite、やってみた。
oscilloscope 見つけたので、やってみた。
ch1にクランクパルス、ch2にカムパルスを送ってみた。

写真

image.png

サンプルコード


import utime
from machine import Pin
from sys import stdin


RESOLUTION_DEG = 5
TOTAL_DEG = 720
STEPS = TOTAL_DEG // RESOLUTION_DEG
t = 1000
step = 0

while True:
	t = t + RESOLUTION_DEG
	step = step + RESOLUTION_DEG
	if step > 720:
		step = 0
	deg = step * RESOLUTION_DEG
	crank_rotation_deg = deg % 360
	tooth_phase = crank_rotation_deg % 30
	if 330 <= crank_rotation_deg < 360:
		ch1 = 0
	else:
		ch1 = 1 if tooth_phase >= 25 else 0
	if 630 <= deg < 655:
		ch2 = 1
	else:
		ch2 = 0
	print(f"T {t} CH1 {ch1} CH2 {ch2}")


以上。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?