<commit_before>require 'pi_piper'
include PiPiper

class Led
  attr_reader :name,
              :pin

  def initialize name, pin_number
    @name = name
    @pin = PiPiper::Pin.new(pin: pin_number, direction: :out)
  end

  def on
    @pin.on
  end

  def off
    @pin.off
  end

  def toggle
    if off?
      on
    else
      off
    end
  end

  def on?
    @pin.read
    @pin.on?
  end<commit_msg>Add a blink method to led<commit_after>require 'pi_piper'
include PiPiper

class Led
  attr_reader :name,
              :pin

  def initialize name, pin_number
    @name = name
    @pin = PiPiper::Pin.new(pin: pin_number, direction: :out)
  end

  def on
    @pin.on
  end

  def off
    @pin.off
  end

  def toggle
    if off?
      on
    else
      off
    end
  end

  def blink times=5, cycle=0.5
    @pin.off
    sleep cycle

    0.step(times-1) do
      @pin.on
      sleep cycle
      @pin.off
      sleep cycle
    end

    @pin.off
  end

  def on?
    @pin.read
    @pin.on?
  end
{'fraction_non_alphanumeric': 0.08249496981891348, 'fraction_numerical': 0.005030181086519115, 'mean_word_length': 1.7638888888888888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3244980', 'n_tokens_mistral': 383, 'n_tokens_neox': 367, 'n_words': 108}