Welcome to the Ypsilon Script documentation. Here you'll find everything you need to start writing code for microcontrollers with Ypsilon Script.
To install Ypsilon Script, follow these steps to set up the compiler from source:
git clone https://github.com/ycharfi09/ypsilon-script.git
cd ypsilon-script
npm install
npm link
The npm link command makes the ysc command available globally.
If needed, you may have to add npm's global bin directory to your PATH environment variable.
Verify the installation by running:
ysc --version
Ypsilon Script uses a modern, clean syntax inspired by Rust and modern languages. Here are some basic syntax rules:
mut for mutable or let for immutablefn{} are required for blocks// Variable declarations
mut int counter = 0
let string message = "Hello"
// Function declaration
fn int add(int a, int b) {
return a + b
}
Ypsilon Script includes over 100 built-in hardware types for common microcontroller peripherals and sensors. Here are some examples:
mut Digital pin13 on pin 13
mut Led statusLed on pin 10
mut Button btn on pin 2
mut TempSensor temp on pin A0
mut DistanceSensor ultrasonic on pins(trig:7, echo:8)
mut UART serial on port 0
mut I2C wire on pins(sda:20, scl:21)
Ypsilon Script supports event-driven programming with special blocks:
on start {
// Initialization code runs once
serial.begin(9600 baud)
}
on loop {
// Main loop code runs repeatedly
statusLed.toggle()
wait 500ms
}
Use Rust-style pattern matching for control flow:
match value {
0 => { print("Zero") }
1...10 => { print("Small") }
_ => { print("Large") }
}
For complete language reference, advanced features, and more examples, please visit the project's GitHub repository documentation: