Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: ebelouet on January 12, 2015, 03:40:59 PM

Title: A20 lcd pwm python
Post by: ebelouet on January 12, 2015, 03:40:59 PM
HI,

I search a python example to control light or lcd off with A20 baord and lcd screen ?

Sincerely
Eric
Title: Re: A20 lcd pwm python
Post by: ebelouet on January 13, 2015, 01:12:55 PM
who has using this function lcd_power = port: PH08<1><0><default><1> with echo for example or python ?

Sincerely
Eric
Title: Re: A20 lcd pwm python
Post by: saarijoki on October 17, 2015, 09:04:46 PM
Quote from: ebelouet on January 13, 2015, 01:12:55 PM
who has using this function lcd_power = port: PH08<1><0><default><1> with echo for example or python ?

Sincerely
Eric

I'm not really sure what you are referring to with this, but here's a python script that will turn the LCD off for one second and then back on.

Modify it to suit your needs.

#!/usr/bin/python
from time import sleep

# Open a file that controls the PB2 pin (PWM0) PWM duty cycle percent. (Can't be zero!)
f = open('/sys/class/pwm-sunxi/pwm0/duty_percent', 'w')
f.write("1");
f.close()
sleep(1)
f = open('/sys/class/pwm-sunxi/pwm0/duty_percent', 'w')
f.write("98");
f.close()
Title: Re: A20 lcd pwm python
Post by: faraz on May 12, 2022, 04:49:56 AM
Hey is this pwm-sunxi class still valid? and is this link https://www.olimex.com/wiki/How_to_add_pwm still valid?

How can I use PWM on A20 lime 2 boards. a library? a code?
Title: Re: A20 lcd pwm python
Post by: LubOlimex on May 12, 2022, 09:48:41 AM
It still works IF YOU USE OLD SUNXI IMAGES. If you don't need latest image it would work.

If you use Olimage it won't work. In Olimage images you can enable PWM via olinuxino-overlay script. Then refer to the documentation here:

https://www.kernel.org/doc/html/v5.10/driver-api/pwm.html