"RC Car" programming help


#1

In mBlock5 I created a program to control a “RC Car”.

when [up arrow] key is pressed
encoder motor [port1] rotates at power [50]%
encoder motor [port2] rotates at power [-50]%
when [up arrow] key is released
encoder motor [port1] rotates at power [0]%
encoder motor [port2] rotates at power [0]%
when [down arrow] key is pressed
encoder motor [port1] rotates at power [-50]%
encoder motor [port2] rotates at power [50]%
when [down arrow] key is released
encoder motor [port1] rotates at power [0]%
when [left arrow] key is pressed
encoder motor [port3] rotates at power [-50]%
when [left arrow] key is released
encoder motor [port3] rotates at power [0]%
when [right arrow] key is pressed
encoder motor [port3] rotates at power [50]%
when [right arrow] key is released
encoder motor [port3] rotates at power [0]%

In mBlock Blockly App for Android tablets

I created two sliders but the “RC Car” has two motors driving rear wheels. One wheel spins froward and other wheel spins backwards. The app doesn’t let me add negative values to slider values. How can I fix the problem?


#2

What device is this for? mBot 2? mBot ranger? You can try this for making values negative:

(use the {a}-{b} block and do nothing - 50)

But there is on the keypad a minus/plus button:

Hope that helps. If you encounter further issues, mention me as @Best_codes.

Thanks for your time,
Best_codes


#3

I have mBot Ultimate 2.0. In mBlock Blockly App for Android tablets

when slider changed
set encoder motor [port1] at speed [slider value of [slider-1]]
set encoder motor [port2] at speed [slider value of [slider-1]]

When I click on [slider value of [],
I have choice of [this], [slider-1], and [slider-2]

I’m not sure if I can add negative sign to [this], [slider-1], and [


#4

Can you please provide screenshots of the blocks?


#5

Imgur


#6

You are using mblock 3 or 4. You can use 5 online at https://ide.mblock.cc/ or download it for a better experience.


#7

What I’m trying to do is to have sliders control the motors on the car. One slider controls the motors driving rear wheels. Another slider controls the motor that steers the car. There’s a thread at Make your own RC Car! that shows me how to build the car and “write” code for it. There’s a book called book ‘mBot & Me IV - The Ultimate Challenge’ but the images were saved as bitmap files, not PDF files. How can I get the book?


#8

https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=http://static.education.makeblock.com/mbotandme.pdf&ved=2ahUKEwirwfHfxfCAAxWLnGoFHerEBkkQFnoECBcQAQ&usg=AOvVaw1vBRV9jiwS4GlESxVCdv7Q