-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc-guide
53 lines (42 loc) · 1.1 KB
/
c-guide
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
sudo apt update
sudo apt install libc6-dev libcap2 libcap-dev
sudo adduser $USER kmem
echo 'SUBSYSTEM=="mem", KERNEL=="mem", GROUP="kmem", MODE="0660"' | sudo tee /etc/udev/rules.d/98-mem.rules
sudo reboot
cd
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz
tar zxvf bcm2835-1.60.tar.gz
cd bcm2835-1.60/
sudo ./configure
sudo make && sudo make check && sudo make install
cd
sudo apt-get install p7zip-full
wget https://www.waveshare.com/w/upload/0/06/Fan_HAT.7z
7z x Fan_HAT.7z -r -o./Fan_HAT
cd
cd Fan_HAT/c/
make clean
make
sudo ./main
# A systemd unit
sudo vi /etc/systemd/system/pwm-led.service
# Paste the below, save and quit
[Unit]
Description=pwm-led
After=network-online.target
[Service]
ExecStart=/usr/bin/bash /home/pi/Fan_HAT/pwm.sh
Restart=on-failure
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target
sudo vi /home/pi/Fan_HAT/pwm.sh
# Paste the below, save and quit
#!/bin/bash
sudo /home/pi/Fan_HAT/c/main &
# At the end reload the daemon , enable and start the service
sudo systemctl daemon-reload
sudo systemctl enable pwm-led.service
#Restart Raspberry
sudo reboot