November 10, 2017
I want the edison to find Easter eggs (electrical tape). Each time it finds an egg, it stops and waits for me to pick up the egg and press the circle button. After Eddy has found four eggs it’s finished and should play a happy song.
I got the program to work, but I am confused about the happy song after finding four eggs. If I put the play music after the main loop, it won’t play. If I put the play music inside an if-memory loop inside the if-line loop, it won’t work. But if I have the play music in both of these locations at the same time, it works. What is going on?
Also, can you tell me what colors the edison will detect? I’d like prettier eggs than black. 😉
August 24, 2015
The line tracker uses red light reflected off the surface to detect lines.
As such white, red and some orange surfaces are “reflective” all other colours should be “non-reflective” however any surface that is glossy or shiny will be “reflective” regardless of colour
In regards to the loop and music, The loop only checks the condition at the start of the loop, so the program needs to make it to the start of the loop before it breaks out and plays the music at the end.
So in your original program without the IF statement at the end, you would have needed to press the round button after finding the 4th egg before the music starts to play
November 10, 2017
I’m still confused about the loops. Keep in mind that I’m not a programmer – just a mom who volunteered to teach a homeschool co-op class. I really appreciate all your help. The advice offered in this forum weighed heavily in my decision to go with Edison. And the price, of course. 😉
After Edison finds the first three “eggs” the counter value is 3. Then:
1. It enters the main loop again, because counter is not > 3
2. It finds the fourth egg, and adds one to the counter value. Counter now = 4.
3. Since counter = 4, it takes the top path of the IF counter = 4 loop and plays music.
4. It goes back to the main loop, but counter is now > 3, so it kicks out of the loop and goes to the end of the program.
5. Plays music and ends.
Why doesn’t the music play twice?
Please help my Ben, you are my only hope.
August 24, 2015
You are doing really well!
The step by step is exactly what programmers do at every level to try and find bugs in code and it’s definitely something I would recommend teaching to the children. When I have taught programming in the past and a student has encountered a bug I sit down with them and step them through the code, asking them to read what each block is actually doing rather then what they think it should be doing, 90% of the time this technique finds a block with the wrong settings or a block in the wrong spot.
In regards to your program, your step by step is correct, I cant see any difference between your logic and your code, So it is possibly to do with robot speed, the time between Edison finish the music at step 3 and starting the music at step 5 is something like 100th of a second, which is not long enough for the human ear to detect, so it would sound like 1 longer set of notes as opposed to two shorter sets
To test this we can add a few extra blocks to the code to double check. I would add a “Flash LED” block to turn the left LED on after the “wait event” in the IF statement from step 3 then add a “Flash LED” block to turn the left LED off and a “wait event” set to one second to the end of the program.
If Edison is playing both sets of notes (which it should be from your step by step), Edison should play a few notes then turn the light on and play a few more, this will still happen quite quickly and you may not hear a stop when Edison turns on the light, it may appear to just turn on halfway through the song. If it does that’s great! it means the code is working and Edison is playing both sets of notes