Sha256: eee49604ce222e476939f5949e2516e5716e7234986130c8292ba232c89ce4ea

Contents?: true

Size: 988 Bytes

Versions: 23

Compression:

Stored size: 988 Bytes

Contents

class SpectraSoftPot < ArduinoSketch

  # demonstrate capability to use soft pot as traditional pot
  # the last pot reading remains "locked" to the last touch point
  # similar same behavior as ipod
  #
  # this sketch assumes a pa_lcd operating at 19200 and one 
  # spectra symbol softpot connected to analog pin 3
  # 

  output_pin 5, :as => :my_lcd, :device => :pa_lcd, :rate => 19200, :clear_screen => :true
  input_pin 3, :as => :sensor_one, :device => :spectra


   def setup
     delay 1000
     my_lcd.setxy 0,0, "spectra symbol"
     my_lcd.setxy 0,1, "soft pot"
     delay 5000
     my_lcd.clearscr
   end

   def loop
     my_lcd.setxy 0,1
     # since lcd's have issues clearing tens and hundreds digits when reading ones, 
     # we use pad_int_to_str, which is a hack to display these cleanly
     # pad_int_to_str takes two arguments: an integer and the final string length
     # 
     my_lcd.print pad_int_to_str sensor_one.soft_lock, 3
     delay 100
   end
    

end

Version data entries

23 entries across 23 versions & 4 rubygems

Version Path
neo_rad-0.4.0 lib/examples/spectra_soft_pot.rb
atduskgreg-rad-0.2.5 lib/examples/spectra_soft_pot.rb
atduskgreg-rad-0.3.0.1 lib/examples/spectra_soft_pot.rb
atduskgreg-rad-0.3.1 lib/examples/spectra_soft_pot.rb
madrona-rad-0.2.6 lib/examples/spectra_soft_pot.rb
madrona-rad-0.2.7 lib/examples/spectra_soft_pot.rb
madrona-rad-0.3.1.1 lib/examples/spectra_soft_pot.rb
madrona-rad-0.3.1 lib/examples/spectra_soft_pot.rb
madrona-rad-0.3.2 lib/examples/spectra_soft_pot.rb
madrona-rad-0.3.3 lib/examples/spectra_soft_pot.rb
madrona-rad-0.3.4 lib/examples/spectra_soft_pot.rb
madrona-rad-0.3.5 lib/examples/spectra_soft_pot.rb
madrona-rad-0.3.6 lib/examples/spectra_soft_pot.rb
madrona-rad-0.3.7 lib/examples/spectra_soft_pot.rb
madrona-rad-0.3.8 lib/examples/spectra_soft_pot.rb
madrona-rad-0.3.9 lib/examples/spectra_soft_pot.rb
madrona-rad-0.4.0 lib/examples/spectra_soft_pot.rb
madrona-rad-0.5.0 lib/examples/spectra_soft_pot.rb
madrona-rad-0.4.3 lib/examples/spectra_soft_pot.rb
madrona-rad-0.4.2 lib/examples/spectra_soft_pot.rb