Last active
May 22, 2021 20:23
-
-
Save leonrinkel/5a5ce462c752c6215bf28fb2ffe486ec to your computer and use it in GitHub Desktop.
raspberry pi linux waveshare oled fan hat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mount sd cards boot partition | |
remove console=tty1 from boot/cmdline.txt | |
add modules_load=pwm_pca9685 to boot/cmdline.txt | |
add dtoverlay=ssd1306,address=0x3c,width=128,height=32,inverted,sequential to boot/firmware/config.txt | |
add dtoverlay=i2c-pwm-pca9685a,addr=0x40 to boot/firmware/config.txt | |
# or | |
$ echo "dtoverlay=ssd1306,address=0x3c,width=128,height=32,inverted,sequential" | sudo tee -a /boot/firmware/config.txt | |
$ echo "dtoverlay=i2c-pwm-pca9685a,addr=0x40" | sudo tee -a /boot/firmware/config.txt | |
$ echo "pwm_pca9685" | sudo tee -a /etc/modules | |
# or | |
$ sudo dtoverlay ssd1306 address=0x3c width=128 height=32 inverted sequential | |
$ sudo dtoverlay i2c-pwm-pca9685a addr=0x40 | |
$ sudo modprobe pwm-pca9685 | |
# configure pwm | |
$ echo 0 | sudo tee /sys/class/pwm/pwmchip0/export | |
$ echo 24000000 | sudo tee /sys/class/pwm/pwmchip0/pwm0/period | |
$ echo 1 | sudo tee /sys/class/pwm/pwmchip0/pwm0/enable | |
# set fan speed | |
$ echo 24000000 | sudo tee /sys/class/pwm/pwmchip0/pwm0/duty_cycle | |
# read temp | |
$ cat /sys/class/thermal/thermal_zone0/temp | |
# write to console | |
$ echo "hello world" | sudo tee -a /dev/tty1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment