<commit_before>require 'pi_piper'

puts "Press the switch to get started"
pin4 = PiPiper::Pin.new(:pin => 4, :direction => :out)
pin5 = PiPiper::Pin.new(:pin => 5, :direction => :out)
pin17 = PiPiper::Pin.new(:pin => 17, :direction => :out)
pin27 = PiPiper::Pin.new(:pin => 27, :direction => :out)


pin17.off
pin27.off

sum = 0

PiPiper.watch :pin => 22, :trigger => :rising do |pin|
  sum += 1
  puts sum

  # get single bits of sum
  pin4.update_value(sum & 0b0001 == 0b0001)
  pin5.update_value(sum & 0b0010 == 0b0010)
  pin17.update_value(sum & 0b0100 == 0b0100)
  pin27.update_value(sum & 0b1000 == 0b1000)
end

PiPiper.wait<commit_msg>pi_counter.rb: Compare masked values to zero.<commit_after>require 'pi_piper'

puts "Press the switch to get started"
pin4 = PiPiper::Pin.new(:pin => 4, :direction => :out)
pin5 = PiPiper::Pin.new(:pin => 5, :direction => :out)
pin17 = PiPiper::Pin.new(:pin => 17, :direction => :out)
pin27 = PiPiper::Pin.new(:pin => 27, :direction => :out)


pin17.off
pin27.off

sum = 0

PiPiper.watch :pin => 22, :trigger => :rising do |pin|
  sum += 1
  puts sum

  # get single bits of sum
  pin4.update_value(sum & 0b0001 != 0)
  pin5.update_value(sum & 0b0010 != 0)
  pin17.update_value(sum & 0b0100 != 0)
  pin27.update_value(sum & 0b1000 != 0)
end

PiPiper.wait
{'fraction_non_alphanumeric': 0.16435185185185186, 'fraction_numerical': 0.08950617283950617, 'mean_word_length': 4.229838709677419, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '1145059', 'n_tokens_mistral': 603, 'n_tokens_neox': 510, 'n_words': 130}