Set GPIO value
> write gpio.1.mode=ouput > write gpio.1.value=1
To update the GPIO pin value, first set the GPIO mode to be outoput and then update the pin value to be the desired value.
Read GPIO value
> write gpio.1.mode=input > read gpio.1.value
To read the GPIO pin value, set the GPIO mode to be input and then read pin value.
Read ADC input value
> write adc.1.mode=on > read adc.1.value
Turn on the Analog-to-Digital Converter (ADC) on pin 1 and then read the converted digital value of the voltage on pin 1. The voltage range on an ADC pin should be from 0V to 3.3V
Analog output by DAC
> write dac.11.mode=on > write dac.11.value=1000
Turn on the Digital-to-Analog Converter (DAC) on pin 11. Write the output value to the DAC. The DAC will convert the given digital value to a voltage in the range from 0V to 3.3V on the pin 11. The range of the digital value should be from 0 to 4095.
Set PWM output
> write pwm1.period=1024 > write pwm1.prescaler=1 > write pwm1.1.duty=0.5 > write pwm1.1.mode=on
pwm1.period defines the period counter of PWM 1. pwm1.prescale is the prescaler of the PWM 1 clock. The period of output wave is defined by both the period counter and the prescaler. pwm1.1.duty=0.5 makes the output wave 50% high and 50% low. Finally, turn on the output on pin 1 by setting the mode to be on
Save current configuration
> write config.save
Save the current configuration on all pins to internal nonvolatile memory. The saved configuration will be automatically loaded at next power up.
Load saved configuration
> write config.load
Load the previously saved configuration and apply the configuration to all pins
Other related command line driven sensors/drivers:
1. Temperature/humidty/pressure sensor: https://hackaday.io/project/185599-command-line-controlled-weather-sensors
2. Contact-less infrared thermometer: https://hackaday.io/project/185305-command-line-controlled-infrared-thermometer
3. Power relay: https://hackaday.io/project/183851-power-relay-with-built-in-command-parser
4. Command line driven Micro-controller: https://hackaday.io/project/184001-extreme-prototyping-using-command-on-dev-board