Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tochigi RubyKaigi 07 LT

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Tochigi RubyKaigi 07 LT

Avatar for seki at druby.org

seki at druby.org

August 26, 2017

More Decks by seki at druby.org

Other Decks in Programming

Transcript

  1. JavaScript൛ let py = 0 let px = 0 let

    y = 0 let oz = 0 let x = 0 let oy = 0 let xz = 0 let ox = 0 input.onButtonPressed(Button.B, () => { ox = input.acceleration(Dimension.X) oy = input.acceleration(Dimension.Y) oz = input.acceleration(Dimension.Z) px = 0 py = 0 xz = 0 }) basic.forever(() => { if (xz == 1) { x = input.acceleration(Dimension.X) - ox y = input.acceleration(Dimension.Z) - oz } else { x = input.acceleration(Dimension.X) - ox y = input.acceleration(Dimension.Y) - oy } basic.clearScreen() led.plot(2 + Math.clamp(-2, 2, (px + x) / 256), 2 - Math.clamp(-2, 2, (py + y) / 128)) px = x py = y }) input.onButtonPressed(Button.A, () => { ox = input.acceleration(Dimension.X) oy = input.acceleration(Dimension.Y) oz = input.acceleration(Dimension.Z) px = 0 py = 0 xz = 1 }) xz = 1 oy = input.acceleration(Dimension.Y) ox = input.acceleration(Dimension.X) oz = input.acceleration(Dimension.Z) px = 0 py = 0 input.setAccelerometerRange(AcceleratorRange.TwoG) 侧⦼כ侭侧ך׫