A20 lcd pwm python

Started by ebelouet, January 12, 2015, 03:40:59 PM

Previous topic - Next topic

ebelouet

HI,

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

Sincerely
Eric

ebelouet

who has using this function lcd_power = port: PH08<1><0><default><1> with echo for example or python ?

Sincerely
Eric

saarijoki

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()

faraz

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?

LubOlimex

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
Technical support and documentation manager at Olimex