Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input.onButtonPressed(Button.A, function () {
- iBIT.Motor(ibitMotor.Forward, 100)
- })
- input.onButtonPressed(Button.B, function () {
- iBIT.Motor(ibitMotor.Backward, 100)
- })
- input.onButtonPressed(Button.AB, function () {
- iBIT.MotorStop()
- })
- input.onGesture(Gesture.TiltLeft, function () {
- iBIT.Servo(ibitServo.SV1, 0)
- iBIT.Servo(ibitServo.SV2, 0)
- })
- serial.redirectToUSB()
- basic.pause(1000)
- basic.forever(function () {
- serial.writeNumber(iBIT.ReadADC(ibitReadADC.ADC0))
- serial.writeString(" ")
- serial.writeNumber(iBIT.ReadADC(ibitReadADC.ADC1))
- serial.writeString(" ")
- serial.writeNumber(iBIT.ReadADC(ibitReadADC.ADC2))
- serial.writeString(" ")
- serial.writeNumber(iBIT.ReadADC(ibitReadADC.ADC3))
- serial.writeString(" ")
- serial.writeNumber(iBIT.ReadADC(ibitReadADC.ADC4))
- serial.writeString(" ")
- serial.writeNumber(iBIT.ReadADC(ibitReadADC.ADC5))
- serial.writeString(" ")
- serial.writeNumber(iBIT.ReadADC(ibitReadADC.ADC6))
- serial.writeString(" ")
- serial.writeNumber(iBIT.ReadADC(ibitReadADC.ADC7))
- serial.writeLine("")
- if (pins.digitalReadPin(DigitalPin.P0) == 1) {
- led.plot(0, 2)
- } else {
- led.unplot(0, 2)
- }
- if (pins.digitalReadPin(DigitalPin.P1) == 1) {
- led.plot(0, 3)
- } else {
- led.unplot(0, 3)
- }
- if (pins.digitalReadPin(DigitalPin.P2) == 1) {
- led.plot(0, 4)
- } else {
- led.unplot(0, 4)
- }
- pins.digitalWritePin(DigitalPin.P19, 0)
- if (pins.digitalReadPin(DigitalPin.P19) == 1) {
- led.plot(3, 3)
- } else {
- led.unplot(3, 3)
- }
- pins.setPull(DigitalPin.P19, PinPullMode.PullUp)
- pins.digitalWritePin(DigitalPin.P20, 0)
- if (pins.digitalReadPin(DigitalPin.P20) == 1) {
- led.plot(4, 3)
- } else {
- led.unplot(4, 3)
- }
- pins.setPull(DigitalPin.P20, PinPullMode.PullUp)
- })
- control.inBackground(function () {
- while (true) {
- iBIT.Servo(ibitServo.SV1, 180)
- iBIT.Servo(ibitServo.SV2, 180)
- basic.pause(1200)
- iBIT.Servo(ibitServo.SV1, 0)
- iBIT.Servo(ibitServo.SV2, 0)
- basic.pause(1200)
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment