[SOLVED] Doubts with scratch programming


#1

Hi Cleo, finally it works fine. Thanks a lot.

I tell you some considerations:
I need to add the block: broadcast(START) after the block broadcast(UPDATE).

For the motors, the interval of speed is (-100,100), With the value 100, It seems the car moves very slow and the battery pack it’s OK.

One question, We have light sensor, that can detect black or white, we don’t have color sensor. Where is the type I must to put in the broadcast block. broadcast(S2 LIGHT) for example.

The last question, still it’s a mistery why I must in the first time open an example and after open my scratch project, in other case the motors don’t work.

Best Regards:

José Luis


#2

Hello @jotona

I didn’t need to have the START block, instead I do an UPDATE every time I want to read. From what I recall, the START block is not necessary, but it’s been a long time since I’ve done Scratch on a BrickPi+. My memory may fail me.

We don’t support the LIGHT sensor unfortunately. As for the motors, can you explain a bit more? Are the motors always slow, or they’re ok but if you set them at 100 then they get slow?

As for the last question: you need to enable the motors first, with a broadcast of MA E or MB E for example.

Cleo


#3

After investigation, it seems you can use the LIGHT sensor by sending a RAW broadcast. I don’t think we can turn the light on, though, at least not with Scratch the way it is.

Cleo


#4

Hi Clero, thanks for tour response.

The motors are always slow.

We need to use the light sensor,is there any way to use them ?

Can we use the color sensor in the scratch and have the optical sensor mounted ?

The readins in the Scratch wil be ok ?

Thanks a lot:

José Luis




#5

Sorry Cleo, I think I have not expressed well. When I say you the light sensor I wanted to say the NXT sensor that reads white or black, It is the typical sensor used to follow a black line. What’s the name of this sensor in Scratch ? Is the color sensor ? If so, What reading provides scratch when it detects a black line ?

Best Regards:

José Luis


#6

Hi Cleo, can you explain with a example the mean of:

" it seems you can use the LIGHT sensor by sending a RAW broadcast"

We need to detect a black line, how we can detect with Scratch?

Best Refards:

José Luis


#7

@jotona

The Light sensor is supported via Python but not in Scratch. The best you could get in Scratch would be the use RAW and interpret the data. I do not have a light sensor myself so I can’t see how it works in Scratch.
As to why it’s not supported in Scratch I honestly don’t know. This was written by someone who is no longer with us, unfortunately.

Cleo


#8

Thank’s Cleo.

Where is the reason, the motors are always slow
?

And, It seems the motor rotation, for example:

They don’t work, the is no movement in the motors.

How could the robot turn 90 degrees if we have 2 engines, for example the A on the left wheel and the B on the right wheel?

And finally, when you say:

"The best you could get in Scratch would be the use RAW and interpret the data"

I have mounted a light or a color sensor ? and how I can do this (use RAW and interpret the data) ?

Thank’s a lot:

José Luis


#9

@jotona, I believe the max values for the motors are 250 (250 and -250) for motor power/speed. If you want to see more power, you might try to increase to those levels.

If you’re using the older BrickPi+, encoders might not work very well. We had to do a lot of work to increase their precision (in the BrickPi3 it is very precise). If you can’t get those blocks to react, you might need to time out their power (IE count for a few seconds and then stop the motors).


#10

Also, just want to make sure you’re looking in the right place because a year ago we moved some software around. For the BrickPi+ (the older model of BrickPi) the software examples are all kept here now.


#11

@jotona

Most of the issues you’re facing are due to trying to apply BrickPi3 information on a BrickPi+. The screenshot you showed for motor rotation would only work on a BrickPi3. Unfortunately we have never documented the brickpi+ as well as we did the brickpi3.

You can read a few things here and here that are relevant to the brickpi+

Thanks,
Cleo


#12

Thanks John, but doing tests, I already realized these values. I assumed they were the same as those used in programming with python.

Thank you anyway.


#13

Thanks Cleo I already Know these links. We simulated the turn, for example turning one wheel forward and the other backward for a few seconds.

Best Regars:
José Luis