SHARE
TWEET

Untitled

a guest May 22nd, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let reading = 0
  2. radio.setTransmitSerialNumber(true)
  3. radio.setGroup(4)
  4. led.setBrightness(64)
  5. basic.forever(function () {
  6.     pins.analogWritePin(AnalogPin.P1, 1023)
  7.     reading = pins.analogReadPin(AnalogPin.P0)
  8.     radio.sendNumber(reading / 4)
  9.     pins.analogWritePin(AnalogPin.P1, 0)
  10.     led.plotBarGraph(
  11.         reading,
  12.         1023
  13.     )
  14.     if (input.buttonIsPressed(Button.A)) {
  15.         basic.showNumber(reading)
  16.     }
  17.     if (reading < 500) {
  18.         basic.showIcon(IconNames.Umbrella)
  19.         pins.servoWritePin(AnalogPin.P2, 0)
  20.         basic.pause(3000)
  21.         pins.servoWritePin(AnalogPin.P2, 80)
  22.         basic.pause(3000)
  23.         pins.analogWritePin(AnalogPin.P2, 0)
  24.     }
  25.     basic.pause(5000)
  26. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top