Closed greg-norris closed 5 years ago
Here is the markdown for the tutorial:
Let's start by doing something simple. Let's light up the Light Bulb on the BrainPad.
You'll notice the project begins with a ||loops:forever||
block. Anything we place inside this block will keep running forever in the program.
loops.forever(function () {
})
Let's drag a new block into the ||loops:forever||
block. In our block menu under Light Bulb, grab the ||lightbulb:set light bulb to||
block and drag it into the ||loops:forever||
block.
forever(function () {
lightbulb.setColor(0xFF0000)
})
If you look in the simulator, you'll see that our Light Bulb is now RED. Click on the RED bubble inside the block we just added. Here you'll be able to change the color of the Light Bulb to any of the colors available on the color pallette.
forever(function () {
lightbulb.setColor(0xFF0000)
})
But what if the exact color you want isn't on the pallette? We can add parameters to change values, and create our own color. To accomplish this we need to drag a ||lightbulb:red green blue||
block inside of the ||lightbulb:set light bulb to||
.
forever(function () {
lightbulb.setColor(lightbulb.rgb(255, 255, 255))
})
Let's suppose we wanted to make our LED blink every second. To do this we will need to add a ||loops:pause||
inside our ||loops:forever||
block. We'll also need to change the parameters value inside the block to 1000 ms, but the Light Bulb still won't blink. Can you guess why?
forever(function () {
lightbulb.setColor(lightbulb.rgb(255, 255, 255))
pause(1000)
})
Our Light Bulb doesn't blink because we never turn off the Light Bulb anywhere in our ||loops:forever||
block. We can accomplish this by adding a ||lightbulb:set brightness||
block right after our ||loops:pause||
block. It defauts to a value of 15, we need to change this to 0. This will turn off the Light Bulb.
forever(function () {
lightbulb.setColor(lightbulb.rgb(255, 255, 255))
pause(1000)
lightbulb.setBrightness(15)
})
But Our Light Bulb still doesn't blink properly. That's because we never tell the BrainPad how long to leave the Light Bulb off. So right after ||lightbulb:set brightness||
block. We need to add another ||loops:pause||
block
forever(function () {
lightbulb.setColor(lightbulb.rgb(255, 255, 255))
pause(1000)
lightbulb.setBrightness(0)
pause(1000)
})
We still need to turn the brightness back up. So we'll add another ||lightbulb:set brightness||
block to complete the task, and set it all the way up to 255 (100%). The Light Bulb on the simulator should be blinking, whatever color we created.
forever(function () {
lightbulb.setColor(lightbulb.rgb(255, 255, 255))
pause(1000)
lightbulb.setBrightness(0)
pause(1000)
lightbulb.setBrightness(100)
})
Missing newlines after the ## titles confuses crowdin.
I've bump an update to the markdown please try again.
@pelikhan Hmmm...all the other tutorials are missing a line space after ## and work correctly. Should the others be changed? Except now the Lightbulb.md won't load at all. I seem to remember the spacing was an issue before.
Testing now.
@pelikhan It appears the issue with the lightbulb.md tutorial no longer loading is, it no longer likes the name "lightbulb.md" when I changed it to "light.md" and changed the link in the code card, it appears to be working now again in English. French doesn't load in lightbulb tutorial though. I assumed its because I changed its name to light.md.
Now all the tutorials don't translate the instruction section. Here is an image of the same section above that isn't translated now in the buzzer.md. I changed the spacing in this file to match yours as well.
You probably need to reapply the translations in cordwin.
Okay cool. Should I space out all the other tutorials like you did for the lightbulb?
Yes because crowdin seems to have a parking issue and goggles the paragraph in the ## header. You will have to reapply translations afterwards.
(Bump to upload the translations)
Awesome, thanks. Any reason why the name of the lightbulb.md was giving me issue vs light.md?
Might be caching. Try an anonymous window. Maybe see in crowdin to see if something is obviously broken.
@pelikhan Okay, here's the latest I found and its kind of a peculiar issue. I fixed the Lightbulb tutorial by changing its name to light.md, everything worked fine. Then I bumped and tagged the version to 0.21.16. After I did this the lightbulb tutorial would no longer load again. To verify this I changed the name from light.md to led.md. Cleared all the caching, , works again, as soon as I bump to v0.21.17 led.md no longer works. I also used an Incognito window to test all with same result, worked until I bumped.
I'm going to change the name again to fix, but as soon as the version is bumped it will break again.
Fixed the lightbulb tut until next bump. Translations inside the other tutorials are all working correctly now. French translation doesn't load the new Lightbulb tut, probably because of the name changes to the .md file, and the fact it won't take the new .md file at Crowdin, until I bump and it builds.
For some reason the words inside the "New, Try this First - LightBulb" tutorial (lightbulb.md) aren't translating correctly. It is the only one that apparently has an issue. It works fine in English. The Title and Inline code snippets are translating correctly, just the instruction in the tutorial are not as shown in the image below.
This is how we would expect it to look as seen in another tutorials shown below.