The first example of analog output uses a LED to realize a fading LED. It can be managed from the Internet via start and stop commands.
Connect the LED as shown in figure 1:
The long PIN is positive as shown in Figure 2.
Write a sketch K to define:
led :: d2 d = 50 start = [led=led+d *,led=0] stop = [led=0] led==0 -> d=50 led==1000 -> d=-50 or simply load the sketch with the command
] load e08_fading_ledTry the following commands now:
] startthe brightness of the LED grows (fade in) and decreases (fade out)
] pausethe fading of the led stops
] playthe fading of the led resumes
] ??--- Periodic commandsled=led+d *shows the periodic commands running
] trace=1ok] # led=led+d...]# led==0 -> d=50# d=50]# led=led+d...] # led==1000 -> d=-50# d=-50] # led=led+d...traces the commands running
] trace=0ends the tracing
] stopturns off the led and stops the fading of the led
] ??nullstop command also clears the commands running.
Try replacing the LED with a BUZZER connected to d2. What happens?
In this lesson you learned: