070 - Circular Display - Fade Up & Down
Summary: All LED's on circular LED display fade-up and fade-down 3 times based on a fade speed variable (BYTE2)
Syntax:
70 <BYTE2> <BYTE3 ><BYTE4> (decimal format)
Where:
BYTE2: Fade Speed (ms) (default is 100 if 0 is entered)
BYTE3: No Function
BYTE4: 0 = One Shot,
BYTE4: 255 = Continuous
Response from IRCF360:
No Response on serial port (unless command 10 was previously sent to IRCF360 to request an echo of each command)
Circular Display Feedback:
LEDs will fade on and off once unless BYTE4=255
Description:
Will trigger the Circular LED to fade up and down 3 times.
The variable FADE_SPEED needs to be set. Enter 0 for default speed of 100. This effects total time of the fade period. For example, if a value of 1 is entered, then there will be 2500us/BYTE2. for the first two fades. The 3rd fade will be half as long.
To obtain a pulsing 'heartbeat' effect enter 300 as BYTE2 (fade speed).
The command is used to enable the robot controller to give visual feedback for example:
Debugging
Indication of robot state
Visual Effect
Display of a particular mood or an expression of emotion within a game or swarm / flock (e.g. sleeping, eating, angry, dead)
Technical Features
The eye is very sensitive to difference in light intensity and sees the proportion of time when the LED is on and off over a fixed period of time, as changes of bright intensity. The proportion of the the time the LED is is on or off determines the brightness of the LED.
The fading UP or DOWN an LED is quite simple. Here is BASIC language routine that gives and indication of how the fade speed and duration can effect the speed of the fade routine. It will make and LED fade brighter and then dimmer. The fade_speed determines how quickly the LED is fading up or down by making bigger steps.
Logic for LED Fade Up & Down
FOR X = 1 To 2500 Step FADE_SPEED
OFF_TIME=2500 -X
ON_TIME = X
GOSUB LED_ON
NEXT
LED_ON:
HIGH B.3 ' Turn on a pin where LED is connected
PAUSE ON_TIME
LOW.B3 ' Turn off a pin where LED is connected
PAUSE OFF_TIME
RETURN
If only simple fade up or down routines are required then try the following alternative commands:
072 SINGLE LED FADE UP & DOWN
073 LEDFADE UP
Example Code:
FADE_LED: SEROUT b.2,T9600_8, (22,25,26,0) ' Send button code 22 and device code 25, once only SERIN 2,T9600_8, button_code, device_code RETURN
SEROUT b.2,T9600_8, (70 0,0,255) ' Fade ALL LED's for default values. Continuous
See the video of this short routine below.
IRCF360 - Demo of command 72 and 70
MAIN:
COMMAND_70_72:
SEROUT b.2,T9600_8, (72, 100 ,0,0) 'Light North LED, for a period of 2500us/<BYTE2>)
SEROUT b.2,T9600_8, (11, 0,0,0) 'Turn off ping pong display
pause 2000
SEROUT b.2,T9600_8, (72 , 100,2,0) 'Light North LED, for a period of 2500us/<BYTE2>)
SEROUT b.2,T9600_8, (11, 0,0,0) 'Turn off ping pong display
SEROUT b.2,T9600_8, (72, 100 ,4,0) 'Light North LED, for a period of 2500us/<BYTE2>)
SEROUT b.2,T9600_8, (11, 0,0,0) 'Turn off ping pong display
pause 2000
SEROUT b.2,T9600_8, (72 , 100,6,0) 'Light North LED, for a period of 2500us/<BYTE2>)
SEROUT b.2,T9600_8, (11, 0,0,0) 'Turn off ping pong display
pause 2000
SEROUT b.2,T9600_8, (73, 100,0,0) 'Light North LED, for a period of 2500us/<BYTE2>)
SEROUT b.2,T9600_8, (11, 0,0,0) 'Turn off ping pong display
pause 2000
GOTO MAIN
Videos: