用ESP32 PWM實現LED漸漸亮起。
程式的部分主要分成三個:1.設定頻道LEDchannel、2.附加到PIN腳、3.決議輸出巨細。
1.設定頻道LEDchannel屬性
ledcSetup(LEDChannel, freq, resolution);
//LEDChannel設定為0,分歧輸出要設定到分歧頻道,例如RGB LED就要開三個頻道分別治理R、G、B
//freq輸出頻率,建議值5000 Hz
//resolution代表輸出解析度,例如8代表0-255,10代表0-1023
2.附加到PIN腳
ledcAttachPin(ledPin, LEDChannel);
//ledPin代表腳位,看你把裝備接在哪一個腳位上面
//LEDchannel代表步調1所宣佈的LEDchannel,也就是說把設定好的LEDchannel屬性附加到某個腳位上
3.決意輸出巨細。
ledcWrite(LEDChannel, dutyCycle);
//將LEDchannel輸出dutyCycle的值。
範例程式將使接在Pin16的LED逐步亮起並熄滅,類型複製於 https://randomnerdtutorials.com/esp32-pwm-arduino-ide/
![Arduino ESP32 PWM輸出 讓LED漸亮漸暗 網 Arduino ESP32 PWM輸出 讓LED漸亮漸暗 網](https://pic.pimg.tw/netyea/1672392091-3727963193-g_n.jpg)
![Arduino ESP32 PWM輸出 讓LED漸亮漸暗 網 Arduino ESP32 PWM輸出 讓LED漸亮漸暗 網](http://www.tshopping.com.tw/data/attachment/forum/202005/12/222251qialhmh1wlko8hz8.jpg)
- // the number of the LED pin
- const int ledPin = 16; // 16 corresponds to GPIO16
-
- // setting PWM properties
- const int freq = 5000;
- const int ledChannel = 0;
- const int resolution = 8;
-
- void setup(){
- // configure LED PWM functionalitites
- ledcSetup(ledChannel, freq, resolution);
-
- // attach the channel to the GPIO to be controlled
- ledcAttachPin(ledPin, ledChannel);
- }
-
- void loop(){
- // increase the LED brightness
- for(int dutyCycle = 0; dutyCycle <= 255; dutyCycle++){
- // changing the LED brightness with PWM
- ledcWrite(ledChannel, dutyCycle);
- delay(15);
- }
-
- // decrease the LED brightness
- for(int dutyCycle = 255; dutyCycle >= 0; dutyCycle--){
- // changing the LED brightness with PWM
- ledcWrite(ledChannel, dutyCycle);
- delay(15);
- }
- }
prescoevlti 發表在 痞客邦 留言(0) 人氣()
網站架設![jQuery 輪播式告白插件 flexslider 利用指南 jQuery 輪播式告白插件 flexslider 利用指南](https://pic.pimg.tw/netyea/1673013276-2735136115-g_n.png)
展現網站
![jQuery 輪播式告白插件 flexslider 利用指南 jQuery 輪播式告白插件 flexslider 利用指南](http://www.tshopping.com.tw/data/attachment/forum/201707/25/224827vxj2z2tzd78y7lmy.png)
發現了個不錯的jQuery幻燈片插件flexslider,有接近3000 Star,應當說是很靠譜的,下面是簡單利用教程。
引入代碼
所有代碼都可以在flexlslider的Github上取得。
引入css 文件和js 文件和jQuery 焦點代碼:
|
prescoevlti 發表在 痞客邦 留言(0) 人氣()
前兩天收到中華電信HINET的德律風
說某一網域被入侵,亂發信被揭發
今天客戶說寄到GMAIL的信全數寄不出去
查了一下,先到下面網址打入IPhttps://mxtoolbox.com
https://www.dnsbl.info/dnsbl-details.php?dnsbl=dnsbl.spfbl.net
![伺服器被當垃圾信跳板 申請DNS IP反解 伺服器被當垃圾信跳板 申請DNS IP反解](https://pic.pimg.tw/netyea/1681398982-1194769291-g_n.png)
發現有被兩個單位列入黑名單
![伺服器被當垃圾信跳板 申請DNS IP反解 伺服器被當垃圾信跳板 申請DNS IP反解](http://www.tshopping.com.tw/data/attachment/forum/202108/13/160329aocoqa9ow1wrpq9z.png)
問了谷歌後,只要在其他dnsbl或是CBL裡沒有記載就好
prescoevlti 發表在 痞客邦 留言(0) 人氣()
網站架設
實例情況:python3.7
BeautifulSoup庫、xlwt庫(需手動安裝)
urllib庫、re庫(內置的python庫,無需手動安裝)
prescoevlti 發表在 痞客邦 留言(0) 人氣()
網站架設
結果圖:
![Yolov8 照片偵測後若何抓物體座標位置 Yolov8 照片偵測後如何抓物體座標位置](https://pic.pimg.tw/netyea/1697008493-2996821079-g.jpg)
座標:
- [[ 16 290]
- [412 491]
- [740 626]
- [283 631]
- [146 651]
- [ 32 710]]
- 5.0
- image 1/1 D:\yolo\bus.jpg: 640x480 4 persons, 1 bus, 1 stop sign, 83.9ms
- Speed: 3.0ms preprocess, 83.9ms inference, 4.0ms postprocess per image at shape (1, 3, 640, 480)
- tensor([[ 22.3412, 228.0822, 802.0841, 754.3939]], device='cuda:0')
- 準確率 0.879738450050354
- x,y: [[412 491]]
- 0.0
- tensor([[ 47.5999, 398.8344, 244.2552, 903.1386]], device='cuda:0')
- 準確率 0.873720109462738
- x,y: [[146 651]]
- 0.0
- tensor([[670.3670, 376.9174, 810.0000, 875.0829]], device='cuda:0')
- 準確率 0.8693700432777405
- x,y: [[740 626]]
- 0.0
- tensor([[220.5713, 405.7240, 344.5589, 857.2506]], device='cuda:0')
- 準確率 0.819391667842865
- x,y: [[283 631]]
- 11.0
- tensor([[7.7698e-02, 2.5441e+02, 3.2119e+01, 3.2465e+02]], device='cuda:0')
- 準確率 0.44594067335128784
- x,y: [[ 16 290]]
- 0.0
- tensor([[3.2650e-02, 5.4988e+02, 6.4001e+01, 8.6930e+02]], device='cuda:0')
- 準確率 0.29976797103881836
- x,y: [[ 32 710]]
-
prescoevlti 發表在 痞客邦 留言(0) 人氣()
紀錄一下批量抓取 Google 搜尋結果裡的保持的方法。
假如還沒有安裝以下,要先下載安裝:
- pip install beautifulsoup4
- pip install google
prescoevlti 發表在 痞客邦 留言(0) 人氣()
網站架設
官方文件鏈結 https://docs.ultralytics.com/models/
程式碼
- from ultralytics import YOLO
- import os
- os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
-
- if __name__ == '__main__':
- # Load a COCO-pretrained YOLOv8n model
- model = YOLO('yolov8n.pt')
-
- # Display model information (optional)
- model.info()
-
- # Train the model on the COCO8 example dataset for 100 epochs
- results = model.train(data='coco8.yaml', epochs=100, imgsz=640)
-
- # Run inference with the YOLOv8n model on the 'bus.jpg' image
- results = model('bus.jpg')
prescoevlti 發表在 痞客邦 留言(0) 人氣()
前台看到 相關商品
![opencart 相關商品(Related Products opencart 相關商品(Related Products](https://pic.pimg.tw/netyea/1675156289-1141491370-g.png)
prescoevlti 發表在 痞客邦 留言(0) 人氣()
近從新調試一段pytorch 程式碼,以前的伺服器上完全沒問題,但換了一台機械,重新安裝了新版本的cuda, anaconda ,pytorch 等,之前的程式碼泛起各類版本不合適的問題。
問題:
目前說說這個問題。運行pytorch 時出現的情況如下:
- RuntimeError:
- An attempt has been made to start a new process before the
- current process has finished its bootstrapping phase.
-
- This probably means that you are not using fork to start your
- child processes and you have forgotten to use the proper idiom
- in the main module:
-
- if __name__ == '__main__':
- freeze_support()
- ...
-
- The "freeze_support()" line can be omitted if the program
- is not going to be frozen to produce an executable.
prescoevlti 發表在 痞客邦 留言(0) 人氣()
網站架設
用nmcli可以成功確立pppoe連線
: (鄙人列例子中,我將pppoe連線定名為ppp0,刻意設定為需要時才手動進行撥接,
: 網卡的裝配名稱為對外enp1s0f0, 對內enp1s0f1)1. 安裝模組 NetworkManager-ppp ppp
enp1s0f0設定IP:192.168.0.254
enp1s0f0設定IP:192.168.1.254
1.安裝模組
- dnf install NetworkManager-ppp -y
- dnf install ppp -y
prescoevlti 發表在 痞客邦 留言(0) 人氣()