- 起動時の初期状態を
STOPに変更。 - 起動シーケンスで必ず
Brake()を実行して安全停止。 - 障害物回避は「
MotionEnabled == Trueかつ前進中」のときだけ有効化。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pyxel | |
| W, H = 200, 150 | |
| class App: | |
| def __init__(self): | |
| pyxel.init(W, H, title="PYXEL BREAKOUT", fps=60) | |
| self.reset() | |
| pyxel.run(self.update, self.draw) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ロボットカーの超音波センサー対応プログラム | |
| # MIT App Inventor / WebブラウザからWi-Fi経由で制御する | |
| # 超音波距離センサーで障害物を検出して回避する | |
| from machine import PWM, Pin, time_pulse_us | |
| import network | |
| import socket | |
| import utime | |
| import _thread |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ロボットカーのモーター動作確認用プログラム | |
| # MIT App Inventor / WebブラウザからWi-Fi経由で制御する | |
| # 超音波距離センサーは使用しない | |
| from machine import PWM, Pin | |
| import network | |
| import socket | |
| import utime | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _="_=%p\n# ** **\n# **** ** ** ****\n# ****** ** ** ******\n#***********************\n# *******************\n# ***************\n# ***********\n# *******\n# ***\n# *\n\nanagram_cp = [111, 84, 33, 128155, 104, 117, 32, 33, 97, 89, 110, 107, 32, 33]\norder = [1, 4, 8, 10, 11, 6, 3, 12, 9, 0, 5, 2, 7, 13]\nmsg = order.map { |i| anagram_cp[i] }.pack(\"U*\")\n# msg => \"Thank 💛 You!!!\"\n$stdout.binmode\nprint _%%_" | |
| # ** ** | |
| # **** ** ** **** | |
| # ****** ** ** ****** | |
| #*********************** | |
| # ******************* | |
| # *************** | |
| # *********** | |
| # ******* | |
| # *** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #*********************************************** | |
| # ロボットカーの制御プログラム | |
| # MIT APP Inventorで作成したタブレットから制御 | |
| # 超音波距離センサで対象物回避 | |
| #*********************************************** | |
| from machine import PWM, Pin | |
| import utime | |
| import network | |
| import socket | |
| import re |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from machine import Pin | |
| import time | |
| # グローバル変数を定義(割り込みフラグ) | |
| touch_detected = False | |
| # 割り込みハンドラ関数 | |
| def touch_handler(pin): | |
| global touch_detected | |
| print("タッチを検知") # 直接ここで反応を表示 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from machine import Pin | |
| import time | |
| # 静電容量タッチセンサーを接続しているピンを設定 | |
| touch_sensor = Pin(28, Pin.IN) | |
| while True: | |
| # タッチセンサーの値を読み取り、タッチされているか確認 | |
| if touch_sensor.value() == 1: | |
| # タッチセンサーがタッチされている場合 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from machine import Pin, I2C | |
| from ssd1306 import SSD1306_I2C | |
| import time | |
| import random | |
| import math | |
| # OLEDディスプレイのサイズ設定 | |
| width = 128 | |
| height = 64 |
NewerOlder