BrightScript Language Examples#
This folder contains 45 comprehensive BrightScript examples demonstrating the language features covered in the BrightScript Language Reference. All examples include on-screen display capabilities using the shared ShowMessage() function from common-functions.brs.
These examples demonstrate BrightScript language features and provide practical coding examples.
Quick Start#
Getting Started with Examples#
To explore the BrightScript language examples:
Option 1: Run All Examples Automatically
- Copy ALL
.brsfiles from the examples folder to your BrightSign SD card root - Rename
run-all-examples.brstoautorun.brs - Insert SD card and reboot - examples run automatically in sequence
Option 2: Individual Example Testing
- Copy desired
.brsfiles to SD card root - Connect via telnet/SSH:
telnet [brightsign-ip] - Run specific examples:
BrightScript> run("01-hello-world.brs")
Important: All .brs files must be in the SD card root directory for the run() function to work properly.
Learning Path Recommendations#
Beginners: Start with the BrightScript Language Reference documentation, then work through the numbered examples (1-27) sequentially to build foundational skills.
Intermediate: After mastering the basic examples, explore the more complex examples and patterns.
Advanced: Focus on the production examples and advanced patterns for scalable application development.
Language Examples#
The examples in this folder provide hands-on learning for BrightScript language features:
Foundation Examples (1-7): Variables, functions, strings, case sensitivity, basic program structure
Object-Oriented Examples (8-11): “m” scope patterns, factory functions, cross-references, dependency injection
Data Structure Examples (12-13): Queue implementations, state machines
Media Examples (14-17): Video/audio players, image slideshows, complete media applications
System Examples (18-20): Network configuration, registry operations, validation patterns
Production Examples (21-27): Event loops, library patterns, event buses, timers, logging systems
Utility Scripts: common-functions.brs, run-all-examples.brs, file management utilities
Media Files: Sample MP4, MP3, PNG, and JPG files for testing media examples
Essential Information#
File Deployment#
Critical: All .brs files must be in the SD card root directory, not in subfolders, for the run() function to work.
Shared Library#
All examples use common-functions.brs which provides:
ShowMessage()- Blue background message displayShowError()- Red background error displayShowSuccess()- Green background success displayClearMessage()- Clear on-screen display
Usage Modes#
- Automatic: Rename
run-all-examples.brstoautorun.brsfor automatic execution on boot - Manual: Connect via telnet/SSH and run individual examples with
run("example-name.brs") - Development: Use individual examples to test specific concepts
Development Philosophy#
This guide follows a learn-by-doing approach with hands-on examples that demonstrate BrightScript language features, from basic syntax through advanced patterns used in production applications.
Additional Resources#
BrightScript Documentation:
Production Code Examples:
- See
external/directory for real-world BrightSign application code - Plugin architecture patterns derived from production BrightSign systems
- Advanced patterns used in digital signage deployments
A complete guide to BrightScript development for BrightSign digital signage players - from basics to production patterns.