GLOBAL SITE AUSTRALIAN SITE

Events misunderstandings | EdScratch programming | Forum

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

Topic3
Events misunderstandings
October 11, 2018
6:02 am
djosh
Member
Members
Forum Posts: 8
Member Since:
September 1, 2016
sp_UserOfflineSmall Offline

Hi

I have a program that moves Edison forward and when he crosses a line he makes a beep.
For that I use the event block named "Line tracker on reflective surface". This code works like a charm but the event is fires the first time at startup of the program (beep when triangle button is pressed).

Is it a normal behavior ?

Thank for your clarification

October 11, 2018
11:00 am
Isaac Nelson
Admin
Forum Posts: 27
Member Since:
March 16, 2018
sp_UserOfflineSmall Offline

Hi,

Would you please be able to attach a share code for your program so that we can have a look at it for you.

To do this you will need to be logged in and save your program. After that, on the menu, you should see a 'share code' option. This will give you a link you can paste here so that people can access a copy of your program.

Don't worry, this is just a copy and people will not be able to change your copy of the program. 

October 11, 2018
7:02 pm
djosh
Member
Members
Forum Posts: 8
Member Since:
September 1, 2016
sp_UserOfflineSmall Offline

Hi Isaac

Here is my code : https://www.edscratchapp.com?share=n0yQxm0o

Thanks a lot

October 12, 2018
12:21 pm
Isaac Nelson
Admin
Forum Posts: 27
Member Since:
March 16, 2018
sp_UserOfflineSmall Offline

Hi,

Thank you for that code, so in short, the answer is yes. It should be triggering that beep.

So because you have the 'turn line tracking on' right at the start, that is what is triggering the event that you set up. Because at the very beginning of the program the light level is essentially '0', but as soon as you turn on the line tracking the light level will find some level of light which will always be greater than 0, so no matter how dark the surface is the event will think it is on a reflective surface for the very first trigger.

October 12, 2018
4:48 pm
djosh
Member
Members
Forum Posts: 8
Member Since:
September 1, 2016
sp_UserOfflineSmall Offline

Yes, very logical ! Thank you Isaac !

So, what would be the right way to do what I want without the starting beep ?
Not use the event block ?

October 15, 2018
11:22 am
Isaac Nelson
Admin
Forum Posts: 27
Member Since:
March 16, 2018
sp_UserOfflineSmall Offline

Hi,

I believe the best way is to use variables. You set a variable that is called 'lightLevel' and set it to 0. Then in Event, you include an if/else block. The if section would be for that first trigger. It would be if(lightLevel = 0), set lightLevel to 1. Then in the else section, you would have it as you had your code before.

  • Keep up with Edison

    Sign up for our newsletter to get all things Edison delivered straight to your inbox.

  • This field is for validation purposes and should be left unchanged.

Heads up

The Australian Federal Parliament has passed a law that extends goods and services tax (GST) to low value imports of physical goods imported by consumers from 1 July 2018.

This means that all customers purchasing Edison robots and accessories with an Australian shipping address must now pay GST. The GST will be automatically added to your purchase and show as a line item on your invoice.

We've detected that you are in Australia, so we wanted to let you know that we have changed your settings to view our Australian site, which displays GST inclusive pricing.

You can change back to the GLOBAL SITE at any time using the link in the top left of the page.

OK got it!    Take me to the GLOBAL SITE instead

Country

Pin It on Pinterest

Share This