Jump to content
THIS IS THE TEST SITE OF EUROBRICKS!
THIS IS THE TEST SITE OF EUROBRICKS!

Featured Replies

Posted

i had some wadering done on www en fond

www.makecode.org

this is a site whit several mirco controlers 

controled by a kind of scratch

you can also program in javasrcipt

i made the folowing js code

[ not tested jet ]

	let move = "wait";
	sensors.remoteButtonTopLeft.onEvent(ButtonEvent.Pressed, function () {
	    move = "turn left"
	})
	sensors.remoteButtonTopRight.onEvent(ButtonEvent.Pressed, function () {
	    move = "forwart"
	})
	sensors.remoteButtonBottomLeft.onEvent(ButtonEvent.Pressed, function () {
	    move = "turn right"
	})
	sensors.remoteButtonBottomRight.onEvent(ButtonEvent.Pressed, function () {
	    move = "backwart"
	})
	motors.stopAll()
	forever(function () {
	    switch (move) {
	        case "turn left":
	            motors.largeBC.tank(-50, 50)
	            break
        case "forwart":
	            motors.largeBC.tank(50, 50)
	            break
	        case "turn right":
            motors.largeBC.tank(50, -50)
	            break
	        case "backwart":
	            motors.largeBC.tank(-50, -50)
	            break
	        default:
	            motors.stopAll()
	            break
	    }
	    control.waitMicros(100)
    move = "wait"
	
})
 
	

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.
Sponsored Links