Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
SekolahRobot
Published © GPL3+

Bottles for Books

Give a bottle to read a book in library. Transforming Trash into Knowledge at the Library

BeginnerFull instructions provided4 hours545

Things used in this project

Hardware components

BBC micro:bit board
BBC micro:bit board
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×2
tcrt5600
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Story

Read more

Schematics

Schematic

Code

bottle for book

JavaScript
pins.servoWritePin(AnalogPin.P1, 90)
pins.servoWritePin(AnalogPin.P2, 90)
basic.forever(function () {
    if (pins.digitalReadPin(DigitalPin.P0) == 0) {
        basic.pause(3000)
        pins.servoWritePin(AnalogPin.P1, 10)
        basic.pause(2000)
        pins.servoWritePin(AnalogPin.P2, 10)
        basic.pause(5000)
    } else {
        pins.servoWritePin(AnalogPin.P1, 90)
        pins.servoWritePin(AnalogPin.P2, 90)
    }
})

Credits

SekolahRobot

SekolahRobot

7 projects • 19 followers
Sekolah Robot Indonesia is non formal education in Indonesia to learning about robot, and base on Community

Comments