Table of Contents

Analog

These functions provide access to analog pins.

Analog Write

  • AWrite(pin, dutyCycle) - Writes to pin using PWM
    pin: pin number
    dutyCycle: 0 to 100
Note

Frequency is fixed to 50hz.

@Loop
For i=0 to 100 Step 10
    AWrite('L',i)
    Wait(100)
next
For i=100 to 0 Step -10
    AWrite('L',i) 
    Wait(100)
Next
Goto Loop

Analog Read

  • ARead(pin) - Read an analog output
    pin: pin number
    Returns: The analog value (0-100) of the pin

Not all pins support ARead(). The hardware docs will show what pins support analog, typically labeled ADC. Pins that do not support ARead() will return 0.

@Loop
For i=0 to 100
    x=ARead(0)
    PrintLn(x)  
    Wait(100)
Next
Goto Loop