Skip to content

Instantly share code, notes, and snippets.

View hasumikin's full-sized avatar
🐕‍🦺
inu

HASUMI Hitoshi hasumikin

🐕‍🦺
inu
View GitHub Profile
@hasumikin
hasumikin / screen.rb
Created September 29, 2025 23:57
macOSとscreenで消耗している人のためのスクリプト
#!/usr/bin/env ruby
require 'fileutils'
DEFAULT_DEVICE = '/dev/ttyUSB0'
DEFAULT_BAUDRATE = '115200'
if ARGV.include?('--help') || ARGV.include?('-h')
puts <<~HELP
This script connects to a serial device using 'screen' and automatically

※和文はページ下部にあります

PicoRuby Workshop 2025 - Buzzer & PWM

Previous sections:

  1. Setup + LED: https://tinyurl.com/picoruby-2025
  2. Microphone: https://tinyurl.com/picoruby-mic

In this section, we'll learn about PWM (Pulse Width Modulation) - a powerful technique that allows us to simulate analog signals using digital outputs. We'll use PWM to create sounds with a buzzer and control LED brightness smoothly.

※和文はページ下部にあります

PicoRuby Workshop 2025 - Microphone & ADC

Previous sections:

  1. Setup + LED: https://tinyurl.com/picoruby-2025

In this section, we'll learn about analog-to-digital conversion (ADC) and explore how to read analog sensors. We'll use a microphone to detect sound levels and also explore the RP2350's built-in temperature sensor.

Setup, general information and trouble shooting

Important Notes

(Also read Trouble Shoot)

Laptop Security Settings

If your laptop is configured to prohibit writing to USB memory devices, likely due to your company's security policy, it will not function in the workshop😣

@hasumikin
hasumikin / keymap.rb
Created April 19, 2023 23:46
PRK Firmware ADC example
require "adc"
require "mouse"
kbd = Keyboard.new
kbd.init_direct_pins( [8] )
kbd.add_layer :default, %i(BOOTSEL)
kbd.define_mode_key :BOOTSEL, [ Proc.new { kbd.bootsel! }, nil, 300, nil ]
@hasumikin
hasumikin / keymap.rb
Created April 19, 2023 23:45
PRK Firmware SPI example (Keyball44)
require "spi"
require "mouse"
require "consumer_key"
class SPI
def pmw3360dm_write(*values)
GPIO.write_at(21, 0)
write(*values)
Machine.delay_us 20
GPIO.write_at(21, 1)
@hasumikin
hasumikin / keymap.rb
Created April 19, 2023 23:45
PRK Firmware I2C example
#
# Pin assignment:
# switch matrix:
# row: 1, 2, 3, 4
# col: 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
# RGBLED: 0
# I2C0: trackball and RTC
# sda_pin: 20
# scl_pin: 21
# SPI1: